Class: Cask::DSL::Base Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Superclass for all stanzas which take a block.

Instance Method Summary collapse

Constructor Details

#initialize(cask, command = SystemCommand) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Base.


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

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

No need to define it as it's the default/superclass implementation. rubocop:disable Style/MissingRespondToMissing


27
28
29
30
31
32
33
34
35
36
# File 'Library/Homebrew/cask/dsl/base.rb', line 27

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

#system_command(executable, **options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


21
22
23
# File 'Library/Homebrew/cask/dsl/base.rb', line 21

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