Module: Gorillib::Hashlike::Serialization
- Included in:
- Gorillib::Hashlike, Hash
- Defined in:
- lib/gorillib/serialization/to_wire.rb
Instance Method Summary collapse
-
#to_wire(options = {}) ⇒ Hash
Returns a hash with each key set to its associated value.
Instance Method Details
#to_wire(options = {}) ⇒ Hash
Returns a hash with each key set to its associated value
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gorillib/serialization/to_wire.rb', line 15 def to_wire(={}) {}.tap do |hsh| each do |attr,val| hsh[attr] = case when val.respond_to?(:to_wire) then val.to_wire() when val.respond_to?(:to_hash) then val.to_hash else val ; end end end end |