Class: Conf
- Inherits:
-
Object
- Object
- Conf
- Defined in:
- lib/vimamsa/conf.rb
Instance Attribute Summary collapse
-
#confh ⇒ Object
readonly
Returns the value of attribute confh.
Instance Method Summary collapse
-
#initialize ⇒ Conf
constructor
A new instance of Conf.
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize ⇒ Conf
Returns a new instance of Conf.
76 77 78 79 |
# File 'lib/vimamsa/conf.rb', line 76 def initialize() @id = [] @confh = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/vimamsa/conf.rb', line 81 def method_missing(method_name, *args) c = ConfId.new(method_name) #TODO: improve if m = method_name.match(/(.*)[\!\?]$/) c = ConfId.new(m[1]) return get(c) end if m = method_name.match(/(.*)=$/) c = ConfId.new(m[1]) set(c, args[0]) return args[0] end return c end |
Instance Attribute Details
#confh ⇒ Object (readonly)
Returns the value of attribute confh.
74 75 76 |
# File 'lib/vimamsa/conf.rb', line 74 def confh @confh end |