Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/hash/keys.rb
Instance Method Summary collapse
-
#syntax_value(keyString, syntax = ".") ⇒ Object
任意のsyntaxで値を取得.
Instance Method Details
#syntax_value(keyString, syntax = ".") ⇒ Object
任意のsyntaxで値を取得
3 4 5 6 7 8 9 10 11 |
# File 'lib/hash/keys.rb', line 3 def syntax_value(keyString, syntax = ".") list = keyString.split(syntax) result = self list.each do |key| key = key.is_i? ? key.to_i : key result = result[key] || result[key.to_sym] end result end |