Class: CDB::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/cdb/cli.rb

Constant Summary collapse

COMMANDS =
%w[search show rename]
TYPES =
%w[series issue issues]

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CLI

Returns a new instance of CLI.



8
9
10
# File 'lib/cdb/cli.rb', line 8

def initialize(options={})
  @options = options
end

Instance Method Details

#[](k) ⇒ Object



12
13
14
# File 'lib/cdb/cli.rb', line 12

def [](k)
  @options[k]
end

#[]=(k, v) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/cdb/cli.rb', line 16

def []=(k, v)
  v = v.to_s.strip
  begin
    send("#{k}=", v)
  rescue NoMethodError
    @options[k] = v
  end
end

#executeObject



25
26
27
# File 'lib/cdb/cli.rb', line 25

def execute
  send self[:command]
end