Class: Amigo::Term

Inherits:
Object show all
Includes:
Hamster::Immutable
Defined in:
lib/amigo/term.rb

Instance Method Summary collapse

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: ==

Returns:

  • (Boolean)


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

#hashObject



38
39
40
# File 'lib/amigo/term.rb', line 38

def hash
  @component.hash ^ @value.hash
end

#join?(statement, row) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/amigo/term.rb', line 22

def join?(statement, row)
  true
end

#select?(statement) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/amigo/term.rb', line 14

def select?(statement)
  @value === statement.send(@component)
end

#to_sparqlObject



26
27
28
# File 'lib/amigo/term.rb', line 26

def to_sparql
  @value.inspect
end