Class: Commander::Command::Options
Overview
Instance Method Summary
collapse
Methods included from Blank
included
Constructor Details
Returns a new instance of Options.
16
17
18
|
# File 'lib/commander/command.rb', line 16
def initialize
@table = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
24
25
26
|
# File 'lib/commander/command.rb', line 24
def method_missing(meth, *args)
meth.to_s =~ /=$/ ? @table[meth.to_s.chop.to_sym] = args.first : @table[meth]
end
|
Instance Method Details
20
21
22
|
# File 'lib/commander/command.rb', line 20
def __hash__
@table
end
|
#default(defaults = {}) ⇒ Object
28
29
30
|
# File 'lib/commander/command.rb', line 28
def default(defaults = {})
@table = defaults.merge! @table
end
|
32
33
34
|
# File 'lib/commander/command.rb', line 32
def inspect
"<Commander::Command::Options #{ __hash__.map { |k, v| "#{k}=#{v.inspect}" }.join(', ') }>"
end
|