Class: SimpleCommander::Command::Options
- Inherits:
-
Object
- Object
- SimpleCommander::Command::Options
show all
- Includes:
- Blank
- Defined in:
- lib/simple_commander/command.rb
Overview
Instance Method Summary
collapse
Methods included from Blank
included
Constructor Details
Returns a new instance of Options.
35
36
37
|
# File 'lib/simple_commander/command.rb', line 35
def initialize
@table = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
43
44
45
|
# File 'lib/simple_commander/command.rb', line 43
def method_missing(meth, *args)
meth.to_s =~ /=$/ ? @table[meth.to_s.chop.to_sym] = args.first : @table[meth]
end
|
Instance Method Details
39
40
41
|
# File 'lib/simple_commander/command.rb', line 39
def __hash__
@table
end
|
#default(defaults = {}) ⇒ Object
47
48
49
|
# File 'lib/simple_commander/command.rb', line 47
def default(defaults = {})
@table = defaults.merge! @table
end
|
51
52
53
|
# File 'lib/simple_commander/command.rb', line 51
def inspect
"<SimpleCommander::Command::Options #{ __hash__.map { |k, v| "#{k}=#{v.inspect}" }.join(', ') }>"
end
|