Class: Relish::Command::Base

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

Direct Known Subclasses

Config, Help, Projects, Push

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dsl

option, option_names

Constructor Details

#initialize(args = []) ⇒ Base

Returns a new instance of Base.



18
19
20
21
22
23
24
# File 'lib/relish/commands/base.rb', line 18

def initialize(args = [])
  @args = clean_args(args)
  @param = get_param
  @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.



15
16
17
# File 'lib/relish/commands/base.rb', line 15

def args=(value)
  @args = value
end

#cli_optionsObject (readonly)

Returns the value of attribute cli_options.



16
17
18
# File 'lib/relish/commands/base.rb', line 16

def cli_options
  @cli_options
end

Instance Method Details

#get_paramObject



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

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

#urlObject



26
27
28
# File 'lib/relish/commands/base.rb', line 26

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