Class: OpenBEL::Model::RdfResource
- Inherits:
-
Object
- Object
- OpenBEL::Model::RdfResource
- Includes:
- OpenBEL::Model
- Defined in:
- lib/openbel/api/model/rdf_resource.rb
Constant Summary
Constants included from OpenBEL::Model
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(attr_values = {}) ⇒ RdfResource
constructor
A new instance of RdfResource.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods included from OpenBEL::Model
Constructor Details
#initialize(attr_values = {}) ⇒ RdfResource
Returns a new instance of RdfResource.
44 45 46 47 48 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 44 def initialize(attr_values = {}) attr_values.each { |k, v| instance_variable_set(:"@#{k}", v) } end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
50 51 52 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 50 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
52 53 54 55 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 52 def ==(other) return false if other == nil @uri == other.uri end |
#hash ⇒ Object
57 58 59 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 57 def hash @uri.hash end |
#to_hash ⇒ Object
61 62 63 64 65 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 61 def to_hash instance_variables.inject({}) { |res, attr| res.merge({attr[1..-1] => instance_variable_get(attr)}) } end |
#to_s ⇒ Object
67 68 69 |
# File 'lib/openbel/api/model/rdf_resource.rb', line 67 def to_s @uri end |