Sha256: 9c75587d1c700fcc46a48457fadba9603e56508c24783ccf86d7040637d8d734
Contents?: true
Size: 337 Bytes
Versions: 3
Compression:
Stored size: 337 Bytes
Contents
module Terrestrial class Serializer def initialize(field_names, object) @field_names = field_names @object = object end attr_reader :field_names, :object def to_h Hash[ field_names.map { |field_name| [field_name, object.public_send(field_name)] } ] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
terrestrial-0.5.0 | lib/terrestrial/serializer.rb |
terrestrial-0.3.0 | lib/terrestrial/serializer.rb |
terrestrial-0.1.1 | lib/terrestrial/serializer.rb |