Sha256: f2fbf14a553507a53cff2fa7d520897970e64aad1889b431ac23991d3724cab1

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 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.3 lib/hari/entity/property.rb