Sha256: 2175445108f49e1590403c9bc619ad99f84bcc155592a30406269234172d6654

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

require 'hari/entity/property/builder'

module Hari
  class Entity
    class Property

      attr_accessor :name, :serializer, :options

      def initialize(name, options = {})
        @name, @options = name.to_s, options
        @serializer = options.delete(:type) || Serialization::String
      end

      def serialize(value)
        serializer.serialize(value, name: name)
      end

      def desserialize(value)
        serializer.desserialize(value, name: name)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hari-0.0.1 lib/hari/entity/property.rb