Class: Icss::Meta::NamedSchema
Overview
full definitions in type/structured_schema.rb and type/union_schema.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#[], #[]=, #attributes, #delete, included, #keys
#attr_set?, included, #receive!, #to_zaml
Instance Attribute Details
Returns the value of attribute is_core.
10
11
12
|
# File 'lib/icss/type/structured_schema.rb', line 10
def is_core
@is_core
end
|
Class Method Details
.receive(schema) ⇒ Object
61
62
63
|
# File 'lib/icss/type/structured_schema.rb', line 61
def self.receive(schema)
super(schema).model_klass
end
|
Instance Method Details
#attrs_to_inscribe ⇒ Object
37
38
39
|
# File 'lib/icss/type/structured_schema.rb', line 37
def attrs_to_inscribe
self.class.field_names
end
|
33
34
35
|
# File 'lib/icss/type/structured_schema.rb', line 33
def is_core?
!!is_core
end
|
#model_klass ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# 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
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 } }
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
|
64
65
66
67
68
69
70
|
# 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
|