Class: Cask::DSL::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
brew/Library/Homebrew/cask/dsl/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(cask, command = SystemCommand) ⇒ Base

Returns a new instance of Base



8
9
10
11
# File 'brew/Library/Homebrew/cask/dsl/base.rb', line 8

def initialize(cask, command = SystemCommand)
  @cask = cask
  @command = command
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'brew/Library/Homebrew/cask/dsl/base.rb', line 19

def method_missing(method, *)
  if method
    underscored_class = self.class.name.gsub(/([[:lower:]])([[:upper:]][[:lower:]])/, '\1_\2').downcase
    section = underscored_class.split("::").last
    Utils.method_missing_message(method, @cask.to_s, section)
    nil
  else
    super
  end
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'brew/Library/Homebrew/cask/dsl/base.rb', line 30

def respond_to_missing?(*)
  true
end

#system_command(executable, **options) ⇒ Object



15
16
17
# File 'brew/Library/Homebrew/cask/dsl/base.rb', line 15

def system_command(executable, **options)
  @command.run!(executable, **options)
end