Class: ActiveTriples::Property
- Inherits:
-
Object
- Object
- ActiveTriples::Property
- Defined in:
- lib/active_triples/property.rb
Overview
TODO:
Should we enforce the interface on the various attributes that are set?
A value object to encapsulate what a Property is. Instantiate with a hash of options.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Symbol.
Instance Method Summary collapse
-
#cast ⇒ Object
Boolean.
-
#class_name ⇒ Object
Class.
-
#initialize(options = {}) ⇒ Property
constructor
A new instance of Property.
-
#predicate ⇒ Object
RDF::Vocabulary::Term.
Constructor Details
#initialize(options = {}) ⇒ Property
Returns a new instance of Property.
9 10 11 12 |
# File 'lib/active_triples/property.rb', line 9 def initialize( = {}) self.name = .fetch(:name) self.attributes = .except(:name) end |
Instance Attribute Details
#name ⇒ Object
Returns Symbol.
15 16 17 |
# File 'lib/active_triples/property.rb', line 15 def name @name end |
Instance Method Details
#cast ⇒ Object
Returns Boolean.
18 19 20 |
# File 'lib/active_triples/property.rb', line 18 def cast attributes.fetch(:cast, false) end |
#class_name ⇒ Object
Returns Class.
23 24 25 |
# File 'lib/active_triples/property.rb', line 23 def class_name attributes[:class_name] end |
#predicate ⇒ Object
Returns RDF::Vocabulary::Term.
28 29 30 |
# File 'lib/active_triples/property.rb', line 28 def predicate attributes[:predicate] end |