class Icss::Meta::HashSchema
HashSchema
describes an Avro Map type (which corresponds to a Ruby Hash
).
Hashes use the type name “hash” (or “map”) and support one attribute:
-
values: the schema of the map's values. Avro Map keys are assumed to be strings.
@example, a map from string to long is declared with:
{"type": "map", "values": "long"}
Public Class Methods
receive(hsh)
click to toggle source
Calls superclass method
Icss::Meta::NamedSchema::receive
# File lib/icss/type/structured_schema.rb, line 193 def self.receive(hsh) hsh.symbolize_keys! warn "Suspicious key :items - hash schema takes :values (#{hsh})" if hsh.has_key?(:items) val = super(hsh) raise ArgumentError, "Value Factory is no good: #{hsh} - #{val._schema}" if val.values.blank? val end
Public Instance Methods
fullname()
click to toggle source
# File lib/icss/type/structured_schema.rb, line 187 def fullname return @fullname if @fullname slug = (Type.klassname_for(values) || object_id.to_s).gsub(/^:*Icss:+/, '').gsub(/:+/, 'Dot') self.fullname = "HashOf#{slug}" end
to_hash()
click to toggle source
# File lib/icss/type/structured_schema.rb, line 200 def to_hash { :type => :map, :values => Type.schema_for(values) } end
type()
click to toggle source
# File lib/icss/type/structured_schema.rb, line 203 def type() :map ; end