Class: Relish::Command::Base

Inherits:
Object
  • Object
show all
Extended by:
Dsl
Includes:
Helpers
Defined in:
lib/relish/commands/base.rb

Direct Known Subclasses

Collab, Config, Help, Projects, Push, Versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dsl

command, desc, option, usage

Methods included from Helpers

error

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]

  validate_cli_options
end

Instance Attribute Details

#args=(value) ⇒ Object (writeonly)

Sets the attribute args

Parameters:

  • value

    the value to set the attribute args to.



20
21
22
# File 'lib/relish/commands/base.rb', line 20

def args=(value)
  @args = value
end

#cli_optionsObject (readonly)

Returns the value of attribute cli_options.



21
22
23
# File 'lib/relish/commands/base.rb', line 21

def cli_options
  @cli_options
end

Instance Method Details

#get_paramObject



35
36
37
# File 'lib/relish/commands/base.rb', line 35

def get_param
  @args.shift if @args.size.odd?
end

#urlObject



31
32
33
# File 'lib/relish/commands/base.rb', line 31

def url
  "#{protocol}://#{host}/api"
end