Class: Bruhl::Relation
- Inherits:
-
Object
- Object
- Bruhl::Relation
- Defined in:
- lib/bruhl.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(left, operator, right) ⇒ Relation
constructor
A new instance of Relation.
- #inspect ⇒ Object
- #to_s ⇒ Object
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
#left ⇒ Object (readonly)
Returns the value of attribute left.
205 206 207 |
# File 'lib/bruhl.rb', line 205 def left @left end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
205 206 207 |
# File 'lib/bruhl.rb', line 205 def operator @operator end |
#right ⇒ Object (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 |
#inspect ⇒ Object
221 222 223 |
# File 'lib/bruhl.rb', line 221 def inspect to_s end |
#to_s ⇒ Object
225 226 227 |
# File 'lib/bruhl.rb', line 225 def to_s "#{@left} #{@operator} #{@right}" end |