Sha256: 21d1bdefc5bda1aadb5bd3eb1af604b31c6cab5e0338b3bda0afb8482a1f45b0
Contents?: true
Size: 705 Bytes
Versions: 1
Compression:
Stored size: 705 Bytes
Contents
require "kamakura/collection_type" require "kamakura/value_type" module Kamakura class Attribute attr_reader :name, :type, :key, :options def initialize(name, type, key: nil, **options) @name = name.to_sym @key = key ? key.to_sym : @name @options = options if type.is_a?(Array) if value_type = Kamakura.lookup_value_type(type[0]) @type = CollectionType.new(value_type) else @type = CollectionType.new(type[0]) end elsif value_type = Kamakura.lookup_value_type(type) @type = value_type else @type = type end end def parse(value) @type.parse(value, @options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kamakura-0.1.0 | lib/kamakura/attribute.rb |