Sha256: 01ab3f28b7603455518887b2d093eb7ae10526f5b390abc6f3800eec47efab34

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

module Hari
  class Entity
    class Property
      autoload :Builder, 'hari/entity/property/builder'

      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.4 lib/hari/entity/property.rb