smerge 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smerge/config.rb +1 -1
- data/lib/smerge/engine.rb +4 -2
- data/lib/smerge/matchers/regexp.rb +13 -0
- data/lib/smerge/{models/rule.rb → rule.rb} +3 -2
- data/lib/smerge/setup.rb +0 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1732cab9c4a4271972f13e67765bb107cbea5654
|
4
|
+
data.tar.gz: 2d1465d5b8ad029ebcd7ce783ccc1f258739cabe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7667abbaa6ada1b0df23ad3e4b9fff88ed00d41ab2b266b5b0e761752b0bea9e728b29bc554b88c4cb7c3d569ffa709a8c86c1827199031fd8d6a657693c431b
|
7
|
+
data.tar.gz: f80c5c13b4c5660c029fa2b811421a0fb484410bc5380e0ce7bb564f314835d8c85c00677f0fa9e6c3425f8a58471f2280319bf1001df8db89db8c06efee0534
|
data/lib/smerge/config.rb
CHANGED
data/lib/smerge/engine.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Smerge
|
2
2
|
class Engine
|
3
|
+
using Matchers
|
4
|
+
|
3
5
|
def initialize(rules)
|
4
6
|
@rules = rules
|
5
7
|
end
|
@@ -7,10 +9,10 @@ module Smerge
|
|
7
9
|
def call(left, right)
|
8
10
|
@rules.each do |rule|
|
9
11
|
next unless rule.match(left, right)
|
10
|
-
return rule.
|
12
|
+
return rule.call(left, right)
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
right
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'smerge/matchers/class'
|
2
2
|
require 'smerge/matchers/object'
|
3
|
+
require 'smerge/matchers/regexp'
|
3
4
|
|
4
5
|
module Smerge
|
5
6
|
class Rule
|
@@ -20,8 +21,8 @@ module Smerge
|
|
20
21
|
self.right.match(right)
|
21
22
|
end
|
22
23
|
|
23
|
-
def
|
24
|
-
block.call(left, right)
|
24
|
+
def call(left, right)
|
25
|
+
self.block.call(left, right)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
data/lib/smerge/setup.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smerge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Thorner
|
@@ -23,7 +23,8 @@ files:
|
|
23
23
|
- lib/smerge/imports/local.rb
|
24
24
|
- lib/smerge/matchers/class.rb
|
25
25
|
- lib/smerge/matchers/object.rb
|
26
|
-
- lib/smerge/
|
26
|
+
- lib/smerge/matchers/regexp.rb
|
27
|
+
- lib/smerge/rule.rb
|
27
28
|
- lib/smerge/setup.rb
|
28
29
|
homepage: https://github.com/benthorner/smerge
|
29
30
|
licenses:
|