Class: ActiveFedora::Relationship
- Inherits:
-
Object
- Object
- ActiveFedora::Relationship
- Defined in:
- lib/active_fedora/relationship.rb
Instance Attribute Summary collapse
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#is_literal ⇒ Object
Returns the value of attribute is_literal.
-
#object ⇒ Object
Returns the value of attribute object.
-
#predicate ⇒ Object
Returns the value of attribute predicate.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
- #generate_uri(input) ⇒ Object
-
#initialize(attr = {}) ⇒ Relationship
constructor
A new instance of Relationship.
- #object_pid=(pid) ⇒ Object
- #subject_pid=(pid) ⇒ Object
Constructor Details
#initialize(attr = {}) ⇒ Relationship
Returns a new instance of Relationship.
6 7 8 9 10 11 12 13 |
# File 'lib/active_fedora/relationship.rb', line 6 def initialize(attr={}) attr.merge!({:is_literal => false}) self.subject = attr[:subject] @predicate = attr[:predicate] self.object = attr[:object] @is_literal = attr[:is_literal] @data_type = attr[:data_type] end |
Instance Attribute Details
#data_type ⇒ Object
Returns the value of attribute data_type.
5 6 7 |
# File 'lib/active_fedora/relationship.rb', line 5 def data_type @data_type end |
#is_literal ⇒ Object
Returns the value of attribute is_literal.
5 6 7 |
# File 'lib/active_fedora/relationship.rb', line 5 def is_literal @is_literal end |
#object ⇒ Object
Returns the value of attribute object.
5 6 7 |
# File 'lib/active_fedora/relationship.rb', line 5 def object @object end |
#predicate ⇒ Object
Returns the value of attribute predicate.
5 6 7 |
# File 'lib/active_fedora/relationship.rb', line 5 def predicate @predicate end |
#subject ⇒ Object
Returns the value of attribute subject.
5 6 7 |
# File 'lib/active_fedora/relationship.rb', line 5 def subject @subject end |
Instance Method Details
#generate_uri(input) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/active_fedora/relationship.rb', line 31 def generate_uri(input) if input.class == Symbol || input == nil return input elsif input.respond_to?(:pid) return "info:fedora/#{input.pid}" else input.include?("info:fedora") ? input : "info:fedora/#{input}" end end |
#object_pid=(pid) ⇒ Object
27 28 29 |
# File 'lib/active_fedora/relationship.rb', line 27 def object_pid=(pid) @object = "info:fedora/#{pid}" end |
#subject_pid=(pid) ⇒ Object
19 20 21 |
# File 'lib/active_fedora/relationship.rb', line 19 def subject_pid=(pid) @subject = "info:fedora/#{pid}" end |