class Icss::Meta::NamedSchema

full definitions in type/structured_schema.rb and type/union_schema.rb

Attributes

is_core[RW]

Public Class Methods

receive(schema) click to toggle source
Calls superclass method
# File lib/icss/type/structured_schema.rb, line 61
def self.receive(schema)
  super(schema).model_klass
end

Public Instance Methods

attrs_to_inscribe() click to toggle source
# File lib/icss/type/structured_schema.rb, line 37
def attrs_to_inscribe
  self.class.field_names
end
is_core?() click to toggle source
# File lib/icss/type/structured_schema.rb, line 33
def is_core?
  !!is_core
end
model_klass() click to toggle source
# File lib/icss/type/structured_schema.rb, line 41
def model_klass
  return @model_klass if @model_klass
  @model_klass = Icss::Meta::NamedType.get_model_klass(fullname, parent_klass||Object)
  model_type = @model_klass.singleton_class
  # inscribe attributes
  attrs_to_inscribe.each do |attr|
    val = self.send(attr)
    model_type.class_eval{ define_method(attr){ val } }
  end
  schema_writer = self
  model_type.class_eval{ define_method(:_schema){ schema_writer } }
  # module inclusions
  parent_metamodels.each do |parent_metamodel|
    @model_klass.class_eval{ include parent_metamodel }
  end
  klass_metatypes.each{|mt| @model_klass.extend(mt) }
  @model_klass.metamodel if @model_klass.respond_to?(:metamodel)
  @model_klass
end
to_hash() click to toggle source
Calls superclass method Icss::ReceiverModel::ActsAsHash#to_hash
# File lib/icss/type/structured_schema.rb, line 64
def to_hash
  hsh = super
  hsh[:type] = type
  hsh[:name] = hsh.delete(:fullname)
  hsh.delete(:is_core)
  hsh
end