class RedParse::ListInNode::UnlessOpNode

Public Class Methods

new(val1,op,val2=nil) click to toggle source
# File lib/redparse/node.rb, line 3002
def initialize(val1,op,val2=nil)
  op,val2=nil,op unless val2
  op=op.ident if op.respond_to? :ident
  @reverse=true
  @loop=false
  replace [val1,val2]
  condition.special_conditions! if condition.respond_to? :special_conditions!
end

Public Instance Methods

condition() click to toggle source
# File lib/redparse/node.rb, line 3000
def condition; right end
consequent() click to toggle source
# File lib/redparse/node.rb, line 3001
def consequent; left end
else() click to toggle source
# File lib/redparse/node.rb, line 3013
def else; consequent end
elsifs() click to toggle source
# File lib/redparse/node.rb, line 3014
def elsifs; [] end
if() click to toggle source
# File lib/redparse/node.rb, line 3011
def if; condition end
op() click to toggle source
# File lib/redparse/node.rb, line 3015
def op; "unless" end
parsetree(o) click to toggle source
# File lib/redparse/node.rb, line 3017
def parsetree(o)
  cond=condition.rescue_parsetree(o)
  actions=[nil, consequent.parsetree(o)]
  if cond.first==:not
    actions.reverse!
    cond=cond.last
  end
  [:if, cond, *actions]
end
then() click to toggle source
# File lib/redparse/node.rb, line 3012
def then; nil end