rename conditional to if expression
This commit is contained in:
15
lib/ast/if_expression.rb
Normal file
15
lib/ast/if_expression.rb
Normal file
@ -0,0 +1,15 @@
|
||||
module Ast
|
||||
class IfExpression < Expression
|
||||
attr_reader :cond, :if_true, :if_false
|
||||
def initialize cond, if_true, if_false
|
||||
@cond, @if_true, @if_false = cond, if_true, if_false
|
||||
end
|
||||
def inspect
|
||||
self.class.name + ".new(" + cond.inspect + ", "+
|
||||
if_true.inspect + "," + if_false.inspect + " )"
|
||||
end
|
||||
def attributes
|
||||
[:cond, :if_true, :if_false]
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user