Class: Holoserve::Tool::Hash::KeySymbolizer
- Inherits:
-
Object
- Object
- Holoserve::Tool::Hash::KeySymbolizer
- Defined in:
- lib/holoserve/tool/hash/key_symbolizer.rb
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(hash_or_array) ⇒ KeySymbolizer
constructor
A new instance of KeySymbolizer.
Constructor Details
#initialize(hash_or_array) ⇒ KeySymbolizer
Returns a new instance of KeySymbolizer.
4 5 6 |
# File 'lib/holoserve/tool/hash/key_symbolizer.rb', line 4 def initialize(hash_or_array) @hash_or_array = hash_or_array end |
Instance Method Details
#hash ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/holoserve/tool/hash/key_symbolizer.rb', line 8 def hash if @hash_or_array.is_a?(Hash) symbolize_keys @hash_or_array elsif @hash_or_array.is_a?(Array) symbolize_keys_of_all @hash_or_array else @hash_or_array end end |