Class: Icss::Meta::RecordSchema
Instance Attribute Summary
Attributes inherited from NamedSchema
#is_core
Instance Method Summary
collapse
#[], #[]=, #attributes, #delete, included, #keys
#attr_set?, included, #receive!, #to_zaml
#basename=, #fullname, #parent_klass, #parent_metamodels, #receive_basename
Methods inherited from NamedSchema
#is_core?, receive
Instance Method Details
#attrs_to_inscribe ⇒ Object
42
43
44
|
# File 'lib/icss/type/record_schema.rb', line 42
def attrs_to_inscribe
[ :doc, :fullname, :is_a, :_domain_id_field, :_doc_hints ]
end
|
#model_klass ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/icss/type/record_schema.rb', line 28
def model_klass
return @model_klass if @model_klass
super
@model_klass.class_eval{ include(::Icss::Meta::RecordModel)}
self.fields.each do |field_schema|
@model_klass.field(field_schema[:name], field_schema[:type], field_schema)
end
@model_klass
end
|
#receive_fields(flds) ⇒ Object
38
39
40
|
# File 'lib/icss/type/record_schema.rb', line 38
def receive_fields(flds)
super(flds.map(&:symbolize_keys!))
end
|
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/icss/type/record_schema.rb', line 17
def to_hash
{
:name => basename,
:namespace => namespace,
:type => type,
:is_a => (respond_to?(:is_a) ? is_a : []),
:doc => doc,
:fields => fields.map(&:to_schema),
}.compact_blank
end
|
15
|
# File 'lib/icss/type/record_schema.rb', line 15
def type() :record ; end
|