Class: Id::Hashifier
- Inherits:
-
Object
- Object
- Id::Hashifier
- Defined in:
- lib/id/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.
8 9 10 |
# File 'lib/id/hashifier.rb', line 8 def initialize(data) @data = data end |
Class Method Details
.hashify(data) ⇒ Object
4 5 6 |
# File 'lib/id/hashifier.rb', line 4 def self.hashify(data) new(data).hashify end |
Instance Method Details
#hashify ⇒ Object
12 13 14 |
# File 'lib/id/hashifier.rb', line 12 def hashify Hash[data.map { |k, v| [ k.to_s, as_data(v) ] }] end |