loose_tight_dictionary 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/loose_tight_dictionary.rb +7 -1
- data/test/test_loose_tight_dictionary.rb +10 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
@@ -48,6 +48,7 @@ class LooseTightDictionary
|
|
48
48
|
attr_accessor :negatives
|
49
49
|
attr_accessor :left_reader
|
50
50
|
attr_accessor :right_reader
|
51
|
+
attr_accessor :blocking_only
|
51
52
|
|
52
53
|
def initialize(right_records, options = {})
|
53
54
|
@right_records = right_records
|
@@ -77,6 +78,10 @@ class LooseTightDictionary
|
|
77
78
|
end
|
78
79
|
}
|
79
80
|
end
|
81
|
+
|
82
|
+
def blocking_only?
|
83
|
+
!!blocking_only
|
84
|
+
end
|
80
85
|
|
81
86
|
def inline_check(left_record, right_record)
|
82
87
|
return unless positives.present? or negatives.present?
|
@@ -132,8 +137,9 @@ class LooseTightDictionary
|
|
132
137
|
|
133
138
|
def left_to_right(left_record)
|
134
139
|
left = read_left left_record
|
135
|
-
i_options_left = i_options left
|
136
140
|
blocking_left = blocking left
|
141
|
+
return if blocking_only? and blocking_left.nil?
|
142
|
+
i_options_left = i_options left
|
137
143
|
t_options_left = t_options left
|
138
144
|
history = Hash.new
|
139
145
|
right_record = right_records.select do |right_record|
|
@@ -68,6 +68,16 @@ class TestLooseTightDictionary < Test::Unit::TestCase
|
|
68
68
|
end
|
69
69
|
|
70
70
|
if ENV['OLD'] == 'true' or ENV['ALL'] == 'true'
|
71
|
+
should "optionally only pay attention to things that match blockings" do
|
72
|
+
assert_equal @a_right, ltd.left_to_right(@a_left)
|
73
|
+
ltd.blocking_only = true
|
74
|
+
assert_equal nil, ltd.left_to_right(@a_left)
|
75
|
+
clear_ltd
|
76
|
+
@blockings.push ['/dash/i']
|
77
|
+
ltd.blocking_only = true
|
78
|
+
assert_equal @a_right, ltd.left_to_right(@a_left)
|
79
|
+
end
|
80
|
+
|
71
81
|
# the example from the readme, considerably uglier here
|
72
82
|
should "check a simple table" do
|
73
83
|
@right = [ 'seamus', 'andy', 'ben' ]
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Seamus Abshere
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-18 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|