Class: VirtualAssembly::Semantizer::SemanticProperty
- Inherits:
-
Object
- Object
- VirtualAssembly::Semantizer::SemanticProperty
- Defined in:
- lib/virtual_assembly/semantizer/semantic_property.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the property.
-
#valueGetter ⇒ Object
The function to call when the value is requested.
-
#valueSetter ⇒ Object
The function to call to store a new value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, &valueGetter) ⇒ SemanticProperty
constructor
“xmlns.com/foaf/0.1/name” or “@id” for instance.
-
#value ⇒ Object
Fetch and returns the value associated to this property.
-
#value=(new_value) ⇒ Object
Stores a new value for this property.
Constructor Details
#initialize(name, &valueGetter) ⇒ SemanticProperty
“xmlns.com/foaf/0.1/name” or “@id” for instance.
property when requested.
61 62 63 64 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 61 def initialize(name, &valueGetter) @name = name @valueGetter = valueGetter end |
Instance Attribute Details
#name ⇒ Object
The name of the property. It generally points to an uri like “xmlns.com/foaf/0.1/name” or it is used to define a reserved linked data property like “@id”.
This should be a String.
44 45 46 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 44 def name @name end |
#valueGetter ⇒ Object
The function to call when the value is requested.
This should be a Proc passed as a Block.
49 50 51 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 49 def valueGetter @valueGetter end |
#valueSetter ⇒ Object
The function to call to store a new value.
This should be a Proc
54 55 56 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 54 def valueSetter @valueSetter end |
Instance Method Details
#==(other) ⇒ Object
76 77 78 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 76 def ==(other) other && name == other.name && value == other.value end |
#value ⇒ Object
Fetch and returns the value associated to this property.
67 68 69 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 67 def value @valueGetter.call end |
#value=(new_value) ⇒ Object
Stores a new value for this property.
72 73 74 |
# File 'lib/virtual_assembly/semantizer/semantic_property.rb', line 72 def value=(new_value) @valueSetter.call(new_value) end |