Class: Factoid::EntitoidRef
- Inherits:
-
Object
- Object
- Factoid::EntitoidRef
- Defined in:
- lib/factoid/entitoid_ref.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
- #deref ⇒ Object
- #eql?(other) ⇒ Boolean
- #full_uri ⇒ Object
-
#initialize(uri, base) ⇒ EntitoidRef
constructor
A new instance of EntitoidRef.
Constructor Details
#initialize(uri, base) ⇒ EntitoidRef
Returns a new instance of EntitoidRef.
10 11 12 13 |
# File 'lib/factoid/entitoid_ref.rb', line 10 def initialize(uri, base) @uri = Addressable::URI.parse(uri) @base = base end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
15 16 17 |
# File 'lib/factoid/entitoid_ref.rb', line 15 def uri @uri end |
Class Method Details
.from_xml(elem) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/factoid/xml.rb', line 43 def EntitoidRef.from_xml(elem) href = elem.attr('xlink:href') base = elem.document.url return EntitoidRef.new(href, base) end |
Instance Method Details
#deref ⇒ Object
21 22 23 |
# File 'lib/factoid/entitoid_ref.rb', line 21 def deref return Entitoid.from_xml(full_uri) end |
#eql?(other) ⇒ Boolean
25 26 27 28 29 30 31 |
# File 'lib/factoid/entitoid_ref.rb', line 25 def eql?(other) if other.class != self.class return false end return other.full_uri == self.full_uri end |
#full_uri ⇒ Object
17 18 19 |
# File 'lib/factoid/entitoid_ref.rb', line 17 def full_uri return Addressable::URI.join(@base, @uri) end |