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