class Icss::Meta::ArraySchema

ArraySchema describes an Array type (as opposed to ArrayType, which implements it)

Arrays use the type name “array” and support a single attribute:

@example, an array of strings is declared with:

{"type": "array", "items": "string"}

Public Class Methods

receive(hsh) click to toggle source
Calls superclass method Icss::Meta::NamedSchema::receive
# File lib/icss/type/structured_schema.rb, line 156
def self.receive(hsh)
  hsh.symbolize_keys!
  warn "Suspicious key :values - array schema takes :items (#{hsh})" if hsh.has_key?(:values)
  val = super(hsh)
  raise ArgumentError, "Items Factory is no good: #{hsh} - #{val._schema.to_hash}" if val.items.blank?
  val
end

Public Instance Methods

fullname() click to toggle source
# File lib/icss/type/structured_schema.rb, line 150
def fullname
  return @fullname if @fullname
  slug = (Type.klassname_for(items) || object_id.to_s).gsub(/^:*Icss:+/, '').gsub(/:+/, 'Dot')
  @fullname = "ArrayOf#{slug}"
end
to_hash() click to toggle source
# File lib/icss/type/structured_schema.rb, line 163
def to_hash
  { :type => :array, :items => Type.schema_for(items) }
end
type() click to toggle source
# File lib/icss/type/structured_schema.rb, line 166
def type() :array ; end