Class: ActiveTriples::Property
- Inherits:
-
Object
- Object
- ActiveTriples::Property
- Defined in:
- lib/active_triples/property.rb
Overview
A value object to encapsulate what a Property is. Instantiate with a hash of options.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
- #name ⇒ Symbol readonly
Instance Method Summary collapse
- #cast ⇒ Boolean
- #class_name ⇒ Class
-
#initialize(options = {}, &block) ⇒ Property
constructor
A new instance of Property.
- #predicate ⇒ RDF::Vocabulary::Term
Constructor Details
#initialize(options = {}, &block) ⇒ Property
Returns a new instance of Property.
17 18 19 20 21 |
# File 'lib/active_triples/property.rb', line 17 def initialize( = {}, &block) self.name = .fetch(:name) self.attributes = .except(:name) self.config = block end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
28 |
# File 'lib/active_triples/property.rb', line 28 attr_reader :name, :config |
#name ⇒ Symbol
28 29 30 |
# File 'lib/active_triples/property.rb', line 28 def name @name end |
Instance Method Details
#cast ⇒ Boolean
32 33 34 |
# File 'lib/active_triples/property.rb', line 32 def cast attributes.fetch(:cast, false) end |
#class_name ⇒ Class
38 39 40 |
# File 'lib/active_triples/property.rb', line 38 def class_name attributes[:class_name] end |
#predicate ⇒ RDF::Vocabulary::Term
44 45 46 |
# File 'lib/active_triples/property.rb', line 44 def predicate attributes[:predicate] end |