Class: ComparisonExpr
- Inherits:
-
Object
- Object
- ComparisonExpr
- Defined in:
- lib/code_generator.rb
Instance Method Summary collapse
- #gen ⇒ Object
-
#initialize(comparison, e1, e2) ⇒ ComparisonExpr
constructor
A new instance of ComparisonExpr.
Constructor Details
#initialize(comparison, e1, e2) ⇒ ComparisonExpr
Returns a new instance of ComparisonExpr.
191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/code_generator.rb', line 191 def initialize comparison, e1, e2 @e1, @e2 = e1, e2 @comparison = { gteq: '>=', lteq: '<=', neq: '!=', eq: '==', gt: '>', lt: '<', }[comparison] end |
Instance Method Details
#gen ⇒ Object
203 204 205 |
# File 'lib/code_generator.rb', line 203 def gen "#{@e1.gen} #{@comparison} #{@e2.gen}" end |