Class: RedParse::Conditional
- Inherits:
-
Object
- Object
- RedParse::Conditional
- Defined in:
- lib/redparse/compile.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(condition, action) ⇒ Conditional
constructor
A new instance of Conditional.
- #name ⇒ Object
- #priority ⇒ Object
Constructor Details
#initialize(condition, action) ⇒ Conditional
Returns a new instance of Conditional.
653 654 655 656 |
# File 'lib/redparse/compile.rb', line 653 def initialize(condition,action) @condition,@action=condition,action @condition.restore :hash,:== end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
657 658 659 |
# File 'lib/redparse/compile.rb', line 657 def action @action end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
657 658 659 |
# File 'lib/redparse/compile.rb', line 657 def condition @condition end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
662 663 664 |
# File 'lib/redparse/compile.rb', line 662 def == other Conditional===other and @condition==other.condition and @action==other.action end |
#hash ⇒ Object
659 660 661 |
# File 'lib/redparse/compile.rb', line 659 def hash @condition.hash^@action.hash end |
#name ⇒ Object
667 |
# File 'lib/redparse/compile.rb', line 667 def name; @condition.inspect+"?"+@action.name end |
#priority ⇒ Object
669 |
# File 'lib/redparse/compile.rb', line 669 def priority; @action.priority end |