Sha256: d86d96afd112944d7be9e4b9732a44cc7ee0ddc5c46f5c9184396e2504ff1870

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 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

      def to_input(value)
        value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transcriber-0.0.13 lib/transcriber/resource/key/property.rb
transcriber-0.0.12 lib/transcriber/resource/key/property.rb
transcriber-0.0.11 lib/transcriber/resource/key/property.rb