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.
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
#action ⇒ Object (readonly)
Returns the value of attribute action.
749 750 751 |
# File 'lib/redparse/compile.rb', line 749 def action @action end |
#condition ⇒ Object (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 |
#hash ⇒ Object
751 752 753 |
# File 'lib/redparse/compile.rb', line 751 def hash @condition.hash^@action.hash end |
#name ⇒ Object
759 |
# File 'lib/redparse/compile.rb', line 759 def name; @condition.inspect+"?"+@action.name end |
#priority ⇒ Object
761 |
# File 'lib/redparse/compile.rb', line 761 def priority; @action.priority end |