Class: Smerge::Rule
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
- #execute(left, right) ⇒ Object
-
#initialize(left, right, block) ⇒ Rule
constructor
A new instance of Rule.
- #match(left, right) ⇒ Object
Constructor Details
#initialize(left, right, block) ⇒ Rule
Returns a new instance of Rule.
12 13 14 15 16 |
# File 'lib/smerge/models/rule.rb', line 12 def initialize(left, right, block) self.left = left self.right = right self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
10 11 12 |
# File 'lib/smerge/models/rule.rb', line 10 def block @block end |
#left ⇒ Object
Returns the value of attribute left.
8 9 10 |
# File 'lib/smerge/models/rule.rb', line 8 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
9 10 11 |
# File 'lib/smerge/models/rule.rb', line 9 def right @right end |
Instance Method Details
#execute(left, right) ⇒ Object
23 24 25 |
# File 'lib/smerge/models/rule.rb', line 23 def execute(left, right) block.call(left, right) end |
#match(left, right) ⇒ Object
18 19 20 21 |
# File 'lib/smerge/models/rule.rb', line 18 def match(left, right) self.left.match(left) && self.right.match(right) end |