Class: Amigo::Term
- Includes:
- Hamster::Immutable
- Defined in:
- lib/amigo/term.rb
Instance Method Summary collapse
- #bind(statement, row) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(component, value) ⇒ Term
constructor
A new instance of Term.
- #join?(statement, row) ⇒ Boolean
- #select?(statement) ⇒ Boolean
- #to_sparql ⇒ Object
Constructor Details
#initialize(component, value) ⇒ Term
Returns a new instance of Term.
9 10 11 12 |
# File 'lib/amigo/term.rb', line 9 def initialize(component, value) @component = component @value = value end |
Instance Method Details
#bind(statement, row) ⇒ Object
18 19 20 |
# File 'lib/amigo/term.rb', line 18 def bind(statement, row) row end |
#eql?(other) ⇒ Boolean Also known as: ==
30 31 32 33 34 35 |
# File 'lib/amigo/term.rb', line 30 def eql?(other) return true if other.equal?(self) other.class.equal?(self.class) && @component.eql?(other.instance_variable_get(:@component)) && @value.eql?(other.instance_variable_get(:@value)) end |
#hash ⇒ Object
38 39 40 |
# File 'lib/amigo/term.rb', line 38 def hash @component.hash ^ @value.hash end |
#join?(statement, row) ⇒ Boolean
22 23 24 |
# File 'lib/amigo/term.rb', line 22 def join?(statement, row) true end |
#select?(statement) ⇒ Boolean
14 15 16 |
# File 'lib/amigo/term.rb', line 14 def select?(statement) @value === statement.send(@component) end |
#to_sparql ⇒ Object
26 27 28 |
# File 'lib/amigo/term.rb', line 26 def to_sparql @value.inspect end |