Class: Synvert::Core::Rewriter::Condition
- Inherits:
-
Object
- Object
- Synvert::Core::Rewriter::Condition
- Defined in:
- lib/synvert/core/rewriter/condition.rb
Overview
Condition checks if rules matches.
Direct Known Subclasses
IfExistCondition, IfOnlyExistCondition, UnlessExistCondition
Instance Method Summary collapse
-
#initialize(instance, rules, &block) ⇒ Synvert::Core::Rewriter::Condition
constructor
Initialize a condition.
-
#process ⇒ Object
If condition matches, run the block code.
Constructor Details
#initialize(instance, rules, &block) ⇒ Synvert::Core::Rewriter::Condition
Initialize a condition.
12 13 14 15 16 |
# File 'lib/synvert/core/rewriter/condition.rb', line 12 def initialize(instance, rules, &block) @instance = instance @rules = rules @block = block end |
Instance Method Details
#process ⇒ Object
If condition matches, run the block code.
19 20 21 |
# File 'lib/synvert/core/rewriter/condition.rb', line 19 def process @instance.instance_eval &@block if match? end |