Class: JamesBond::Core::Command
- Inherits:
-
Object
- Object
- JamesBond::Core::Command
- Defined in:
- lib/james_bond/core/command.rb
Constant Summary collapse
- RESERVED_COMMANDS =
["env", "run", "server", "test", "deploy", "console"].freeze
Instance Attribute Summary collapse
-
#arguments_string ⇒ Object
Returns the value of attribute arguments_string.
-
#argv ⇒ Object
Returns the value of attribute argv.
-
#env ⇒ Object
Returns the value of attribute env.
-
#main_command ⇒ Object
Returns the value of attribute main_command.
-
#options ⇒ Object
Returns the value of attribute options.
-
#raw_arguments ⇒ Object
Returns the value of attribute raw_arguments.
-
#user_command ⇒ Object
Returns the value of attribute user_command.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(argv:, env:) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(argv:, env:) ⇒ Command
Returns a new instance of Command.
14 15 16 17 18 19 20 21 |
# File 'lib/james_bond/core/command.rb', line 14 def initialize(argv:, env:) @argv = argv @user_command = argv.join(" ") @main_command = argv.first @raw_arguments = argv.drop(1) @arguments_string = @raw_arguments.join(" ") @env = env end |
Instance Attribute Details
#arguments_string ⇒ Object
Returns the value of attribute arguments_string.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def arguments_string @arguments_string end |
#argv ⇒ Object
Returns the value of attribute argv.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def argv @argv end |
#env ⇒ Object
Returns the value of attribute env.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def env @env end |
#main_command ⇒ Object
Returns the value of attribute main_command.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def main_command @main_command end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def @options end |
#raw_arguments ⇒ Object
Returns the value of attribute raw_arguments.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def raw_arguments @raw_arguments end |
#user_command ⇒ Object
Returns the value of attribute user_command.
6 7 8 |
# File 'lib/james_bond/core/command.rb', line 6 def user_command @user_command end |
Instance Method Details
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/james_bond/core/command.rb', line 23 def empty? @argv.empty? end |