Class: SonJay::ObjectModel
- Inherits:
-
Object
- Object
- SonJay::ObjectModel
show all
- Includes:
- ActsAsModel
- Defined in:
- lib/son_jay/object_model.rb,
lib/son_jay/object_model/content.rb,
lib/son_jay/object_model/content_data.rb,
lib/son_jay/object_model/content/abstract.rb,
lib/son_jay/object_model/properties_definer.rb,
lib/son_jay/object_model/property_definition.rb,
lib/son_jay/object_model/property_definitions.rb,
lib/son_jay/object_model/content/content_with_extra.rb,
lib/son_jay/object_model/content/content_without_extra.rb
Defined Under Namespace
Modules: Content
Classes: ContentData, PropertiesDefiner, PropertyDefinition, PropertyDefinitions
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
included, #inspect, #sonj_content, #to_s
Constructor Details
Returns a new instance of ObjectModel.
14
15
16
17
18
19
|
# File 'lib/son_jay/object_model.rb', line 14
def initialize
definitions = self.class.property_definitions
@model_content = ObjectModel::Content.new(
definitions, self.class.
)
end
|
Instance Attribute Details
#model_content ⇒ Object
Returns the value of attribute model_content.
12
13
14
|
# File 'lib/son_jay/object_model.rb', line 12
def model_content
@model_content
end
|
Class Method Details
60
61
62
|
# File 'lib/son_jay/object_model.rb', line 60
def
@extras_allowed ||= false
end
|
.property_definitions ⇒ Object
64
65
66
|
# File 'lib/son_jay/object_model.rb', line 64
def property_definitions
@property_definitions ||= _evaluate_property_definitions
end
|
Instance Method Details
#[](name) ⇒ Object
35
36
37
38
39
|
# File 'lib/son_jay/object_model.rb', line 35
def [](name)
name = self.class.property_definitions.name_from(name)
source = property_store_for( name )
source[ name ]
end
|
#[]=(name, value) ⇒ Object
29
30
31
32
33
|
# File 'lib/son_jay/object_model.rb', line 29
def []=(name, value)
name = self.class.property_definitions.name_from(name)
target = property_store_for( name )
target[ name ] = value
end
|
#fetch(name) ⇒ Object
41
42
43
|
# File 'lib/son_jay/object_model.rb', line 41
def fetch(name)
model_content.fetch( name )
end
|
#to_h ⇒ Object
25
26
27
|
# File 'lib/son_jay/object_model.rb', line 25
def to_h
model_content.to_h
end
|
#to_json(*args) ⇒ Object
21
22
23
|
# File 'lib/son_jay/object_model.rb', line 21
def to_json(*args)
model_content.to_json( *args )
end
|