Class: Evri::Relation
- Inherits:
-
Object
- Object
- Evri::Relation
- Defined in:
- lib/evri/relation.rb
Overview
Represents a relation.
Instance Attribute Summary collapse
-
#href ⇒ Object
Returns the value of attribute href.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#entities ⇒ Object
Returns the entities in this relation.
-
#initialize(json) ⇒ Relation
constructor
:nodoc:.
Constructor Details
#initialize(json) ⇒ Relation
:nodoc:
5 6 7 8 9 10 |
# File 'lib/evri/relation.rb', line 5 def initialize json # :nodoc: @name = json[:name] @href = json[:href] @type = json[:type] @entities = [] end |
Instance Attribute Details
#href ⇒ Object
Returns the value of attribute href.
4 5 6 |
# File 'lib/evri/relation.rb', line 4 def href @href end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/evri/relation.rb', line 4 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/evri/relation.rb', line 4 def type @type end |
Instance Method Details
#entities ⇒ Object
Returns the entities in this relation.
13 14 15 16 17 18 19 20 21 |
# File 'lib/evri/relation.rb', line 13 def entities return @entities unless @entities.empty? json = Evri.query(:type => :uri, :query => @href) @entities = Entity.create_many do json["relations/relation/targets/entity"] end @entities end |