Handles attributes with Hash type
FIXME: remove this once axiom-types supports it
@private
@api private
# File lib/virtus/attribute/hash.rb, line 89 def self.build_type(definition) Type.infer(definition.type) end
@api private
# File lib/virtus/attribute/hash.rb, line 94 def self.merge_options!(type, options) options[:key_type] ||= Attribute.build(type.key_type, :strict => options[:strict]) options[:value_type] ||= Attribute.build(type.value_type, :strict => options[:strict]) end
Coerce members
@see [Attribute#coerce]
@api public
# File lib/virtus/attribute/hash.rb, line 104 def coerce(*) coerced = super return coerced unless coerced.respond_to?(:each_with_object) coerced.each_with_object({}) do |(key, value), hash| hash[key_type.coerce(key)] = value_type.coerce(value) end end
Generated with the Darkfish Rdoc Generator 2.