Class: Hbc::CLI::AbstractCommand

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Options

included, #process_arguments

Constructor Details

#initialize(*args) ⇒ AbstractCommand

Returns a new instance of AbstractCommand



41
42
43
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 41

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

Instance Attribute Details

#argsObject

Returns the value of attribute args



38
39
40
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 38

def args
  @args
end

Class Method Details

.abstract?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 18

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

.command_nameObject



14
15
16
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 14

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

.helpObject



26
27
28
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 26

def self.help
  nil
end

.needs_init?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 30

def self.needs_init?
  false
end

.run(*args) ⇒ Object



34
35
36
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 34

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

.visibleObject



22
23
24
# File 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb', line 22

def self.visible
  true
end