Class: RedParse::Conditional

Inherits:
Object
  • Object
show all
Defined in:
lib/redparse/compile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(condition, action) ⇒ Conditional

Returns a new instance of Conditional.



745
746
747
748
# File 'lib/redparse/compile.rb', line 745

def initialize(condition,action)
  @condition,@action=condition,action
  @condition.restore :hash,:==
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



749
750
751
# File 'lib/redparse/compile.rb', line 749

def action
  @action
end

#conditionObject (readonly)

Returns the value of attribute condition.



749
750
751
# File 'lib/redparse/compile.rb', line 749

def condition
  @condition
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



754
755
756
# File 'lib/redparse/compile.rb', line 754

def == other
  Conditional===other and @condition==other.condition and @action==other.action
end

#hashObject



751
752
753
# File 'lib/redparse/compile.rb', line 751

def hash
  @condition.hash^@action.hash
end

#nameObject



759
# File 'lib/redparse/compile.rb', line 759

def name; @condition.inspect+"?"+@action.name end

#priorityObject



761
# File 'lib/redparse/compile.rb', line 761

def priority; @action.priority end