Sha256: ae20438efa31355dbdd3f973e3a76e023c1bb5c068089ca1328e0e56caa973a7

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

module Transcriber
  class Resource
    class Property < Key
      include Parser::Property
      include Response::Property

      attr_accessor :serializer
      attr_accessor :translations

      def initialize(name, options = {})
        super
        @serializer   = options.fetch(:type, Serialization::String)
        @translations = options[:values]        if options[:values].kind_of?(Proc)
        @translations = options[:values].invert if options[:values].kind_of?(Hash)
      end

      def from_hash(value)
        value
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
transcriber-0.0.10 lib/transcriber/resource/key/property.rb
transcriber-0.0.9 lib/transcriber/resource/key/property.rb