Class: Bruhl::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/bruhl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, operator, right) ⇒ Relation

Returns a new instance of Relation.



206
207
208
209
210
# File 'lib/bruhl.rb', line 206

def initialize(left, operator, right)
  @left     = left
  @operator = operator
  @right    = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



205
206
207
# File 'lib/bruhl.rb', line 205

def left
  @left
end

#operatorObject (readonly)

Returns the value of attribute operator.



205
206
207
# File 'lib/bruhl.rb', line 205

def operator
  @operator
end

#rightObject (readonly)

Returns the value of attribute right.



205
206
207
# File 'lib/bruhl.rb', line 205

def right
  @right
end

Instance Method Details

#==(other) ⇒ Object



212
213
214
215
216
217
218
219
# File 'lib/bruhl.rb', line 212

def ==(other)
  puts @left, @left.class
  puts other.left, other.left.class
  other.is_a?(Relation)         &&
    @left     == other.left     &&
    @operator == other.operator &&
    @right    == other.right
end

#inspectObject



221
222
223
# File 'lib/bruhl.rb', line 221

def inspect
  to_s
end

#to_sObject



225
226
227
# File 'lib/bruhl.rb', line 225

def to_s
  "#{@left} #{@operator} #{@right}"
end