Class: TracWiki::HashStruct
- Inherits:
-
Hash
- Object
- Hash
- TracWiki::HashStruct
show all
- Defined in:
- lib/trac-export-wiki.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/trac-export-wiki.rb', line 24
def method_missing(sym, *args, &block)
if has_key?(sym.to_sym)
self[sym.to_sym]
else
super
end
end
|
Class Method Details
.[](*hash) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/trac-export-wiki.rb', line 10
def self.[](*hash)
case hash.first
when Hash
super(*hash.first.map {|k, v| [k.to_sym, v] }.flatten(1))
else
i = 0
super(*hash.map {|e| e = i % 2 == 0 ? e.to_sym : e; i += 1; e })
end
end
|
Instance Method Details
#[]=(key, value) ⇒ Object
20
21
22
|
# File 'lib/trac-export-wiki.rb', line 20
def []=(key, value)
super(key.to_sym, value)
end
|