Class: ActiveTriples::Property

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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(options = {})
  self.name = options.fetch(:name)
  self.attributes = options.except(:name)
end

Instance Attribute Details

#nameObject

Returns Symbol.

Returns:

  • Symbol



15
16
17
# File 'lib/active_triples/property.rb', line 15

def name
  @name
end

Instance Method Details

#castObject

Returns Boolean.

Returns:

  • Boolean



18
19
20
# File 'lib/active_triples/property.rb', line 18

def cast
  attributes.fetch(:cast, false)
end

#class_nameObject

Returns Class.

Returns:

  • Class



23
24
25
# File 'lib/active_triples/property.rb', line 23

def class_name
  attributes[:class_name]
end

#predicateObject

Returns RDF::Vocabulary::Term.

Returns:

  • RDF::Vocabulary::Term



28
29
30
# File 'lib/active_triples/property.rb', line 28

def predicate
  attributes[:predicate]
end