Class: Structural::Hashifier
- Inherits:
-
Object
- Object
- Structural::Hashifier
- Defined in:
- lib/structural/hashifier.rb
Class Method Summary collapse
Instance Method Summary collapse
- #hashify ⇒ Object
-
#initialize(data) ⇒ Hashifier
constructor
A new instance of Hashifier.
Constructor Details
#initialize(data) ⇒ Hashifier
Returns a new instance of Hashifier.
7 8 9 |
# File 'lib/structural/hashifier.rb', line 7 def initialize(data) @data = data end |
Class Method Details
.hashify(data) ⇒ Object
3 4 5 |
# File 'lib/structural/hashifier.rb', line 3 def self.hashify(data) new(data).hashify end |
Instance Method Details
#hashify ⇒ Object
11 12 13 |
# File 'lib/structural/hashifier.rb', line 11 def hashify Hash[data.map { |k, v| [ k.to_s, as_data(v) ] }] end |