Class: Relish::Command::Base
- Inherits:
-
Object
- Object
- Relish::Command::Base
- Extended by:
- Dsl
- Includes:
- Helpers
- Defined in:
- lib/relish/commands/base.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
writeonly
Sets the attribute args.
-
#cli_options ⇒ Object
readonly
Returns the value of attribute cli_options.
Instance Method Summary collapse
- #get_param ⇒ Object
-
#initialize(args = []) ⇒ Base
constructor
A new instance of Base.
- #url ⇒ Object
Methods included from Dsl
Methods included from Helpers
Constructor Details
#initialize(args = []) ⇒ Base
Returns a new instance of Base.
23 24 25 26 27 28 29 |
# File 'lib/relish/commands/base.rb', line 23 def initialize(args = []) @args = clean_args(args) @param = get_param.extend(ParamMethods) @cli_options = Hash[*@args] end |
Instance Attribute Details
#args=(value) ⇒ Object (writeonly)
Sets the attribute args
20 21 22 |
# File 'lib/relish/commands/base.rb', line 20 def args=(value) @args = value end |
#cli_options ⇒ Object (readonly)
Returns the value of attribute cli_options.
21 22 23 |
# File 'lib/relish/commands/base.rb', line 21 def @cli_options end |
Instance Method Details
#get_param ⇒ Object
35 36 37 |
# File 'lib/relish/commands/base.rb', line 35 def get_param @args.shift if @args.size.odd? end |
#url ⇒ Object
31 32 33 |
# File 'lib/relish/commands/base.rb', line 31 def url "#{protocol}://#{host}/api" end |