2014-05-05 09:02:02 +02:00
|
|
|
module Ast
|
|
|
|
class ConditionalExpression < 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
|
2014-05-10 18:02:51 +02:00
|
|
|
def inspect
|
|
|
|
self.class.name + ".new(" + cond.inspect + ", "+
|
|
|
|
if_true.inspect + "," + if_false.inspect + " )"
|
|
|
|
end
|
2014-05-10 11:54:10 +02:00
|
|
|
def attributes
|
|
|
|
[:cond, :if_true, :if_false]
|
2014-05-05 09:02:02 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|