Class: Cask::Cmd::AbstractCommand

Inherits:
Object
  • Object
show all
Includes:
Options, Homebrew::Search
Defined in:
brew/Library/Homebrew/cask/cmd/abstract_command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Methods included from Options

#process_arguments

Constructor Details

#initialize(*args) ⇒ AbstractCommand

Returns a new instance of AbstractCommand



42
43
44
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 42

def initialize(*args)
  @args = process_arguments(*args)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args



39
40
41
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 39

def args
  @args
end

Class Method Details

.abstract?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 23

def self.abstract?
  name.split("::").last.match?(/^Abstract[^a-z]/)
end

.command_nameObject



19
20
21
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 19

def self.command_name
  @command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end

.helpObject



31
32
33
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 31

def self.help
  nil
end

.run(*args) ⇒ Object



35
36
37
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 35

def self.run(*args)
  new(*args).run
end

.visibleObject



27
28
29
# File 'brew/Library/Homebrew/cask/cmd/abstract_command.rb', line 27

def self.visible
  true
end