class RedParse::ListInNode::TernaryNode

Public Class Methods

new(if_,qm,then_,colon,else_) click to toggle source
Calls superclass method RedParse::ListInNode::Node::new
# File lib/redparse/node.rb, line 4739
def initialize(if_,qm,then_,colon,else_)
  super(if_,then_,else_)
  condition.special_conditions! if condition.respond_to? :special_conditions!
  @offset=self.first.offset
end

Public Instance Methods

elsifs() click to toggle source
# File lib/redparse/node.rb, line 4751
def elsifs; [] end
image() click to toggle source
# File lib/redparse/node.rb, line 4745
def image; "(?:)" end
parsetree(o) click to toggle source
# File lib/redparse/node.rb, line 4753
def parsetree(o)
  cond=condition.rescue_parsetree(o)
  cond[0]=:fcall if cond[0]==:vcall and cond[1].to_s[/[?!]$/]
  [:if, cond, consequent.begin_parsetree(o), otherwise.begin_parsetree(o)]
end
unparse(o=default_unparse_options) click to toggle source
# File lib/redparse/node.rb, line 4747
def unparse o=default_unparse_options
  "#{condition.unparse o} ? #{consequent.unparse o} : #{otherwise.unparse o}"      
end