Class: BranchIOCLI::Command::Command
- Inherits:
-
Object
- Object
- BranchIOCLI::Command::Command
show all
- Defined in:
- lib/branch_io_cli/command/command.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Command
Returns a new instance of Command.
32
33
34
35
|
# File 'lib/branch_io_cli/command/command.rb', line 32
def initialize(options)
@options = options
@config = self.class.configuration_class.new options
end
|
Instance Attribute Details
#config ⇒ Object
command-specific configuration object
30
31
32
|
# File 'lib/branch_io_cli/command/command.rb', line 30
def config
@config
end
|
#options ⇒ Object
command-specific options from CLI
29
30
31
|
# File 'lib/branch_io_cli/command/command.rb', line 29
def options
@options
end
|
Class Method Details
.available_options ⇒ Object
16
17
18
|
# File 'lib/branch_io_cli/command/command.rb', line 16
def available_options
configuration_class.available_options
end
|
.command_name ⇒ Object
5
6
7
8
|
# File 'lib/branch_io_cli/command/command.rb', line 5
def command_name
matches = /BranchIOCLI::Command::(\w+)Command/.match name
matches[1].downcase
end
|
.configuration_class ⇒ Object
10
11
12
13
14
|
# File 'lib/branch_io_cli/command/command.rb', line 10
def configuration_class
root = command_name.capitalize
BranchIOCLI::Configuration.const_get("#{root}Configuration")
end
|
.examples ⇒ Object
20
21
22
|
# File 'lib/branch_io_cli/command/command.rb', line 20
def examples
configuration_class.examples if configuration_class.respond_to?(:examples)
end
|
.return_value ⇒ Object
24
25
26
|
# File 'lib/branch_io_cli/command/command.rb', line 24
def return_value
configuration_class.return_value if configuration_class.respond_to?(:return_value)
end
|
Instance Method Details
#helper ⇒ Object
41
42
43
|
# File 'lib/branch_io_cli/command/command.rb', line 41
def helper
Helper::BranchHelper
end
|
#patch_helper ⇒ Object
45
46
47
|
# File 'lib/branch_io_cli/command/command.rb', line 45
def patch_helper
Helper::PatchHelper
end
|
#run! ⇒ Object
37
38
39
|
# File 'lib/branch_io_cli/command/command.rb', line 37
def run!
end
|
49
50
51
|
# File 'lib/branch_io_cli/command/command.rb', line 49
def tool_helper
Helper::ToolHelper
end
|