invoca-utils 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9af5982666a515cac52ec601dcc30bb8be8b473a
4
- data.tar.gz: ab9b463b80311d295136c72b5df683b959e03579
3
+ metadata.gz: 14c0f52c191ceaa28ea84e6c14c7dedcee379d12
4
+ data.tar.gz: ec9d1132db9c4c9ea067e5797e464d4b194d4d0e
5
5
  SHA512:
6
- metadata.gz: 0b807a493e7bedc3eca0901d3276723d8cadc91cd3a67a2b31b009695f0be4ffd16562254802a9aab4526b29bd463da17b942400e197a122d08a41e0c37b8c8c
7
- data.tar.gz: 4fcf0da07ac921a2410271dd84c94599ca5ee8893be9db532e41970141fdd35172459f843a32c8cabbc2887b13b4d039991059322a43359090565cbf34a603ea
6
+ metadata.gz: d5cea013efd99a4a8a34593bd95fb601135c0abe96aa53e579b8e6b47a8d3d4f8c34cd6d34a8e635067909835500a160a646c6105f8c658a2827698f83de9b40
7
+ data.tar.gz: 3a9101e2351ef8081b6199109ed97d5f22d50d306e6762519f68742cd624de3773daeabd5d7d7ecfe5c6260357c0e02a91870b87ab695f96b123d74f3b4c7712
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  *.a
22
22
  mkmf.log
23
23
  .idea/
24
+ .rubocop-http*
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ # This rubocop config file inherits from our centralized style-guide repository.
2
+ # If you are looking to update the ruby style guide, be sure to both update the rubocop config
3
+ # as well as the README.md
4
+ # https://github.com/Invoca/style-guide/tree/master/ruby
5
+ inherit_from: https://raw.githubusercontent.com/Invoca/style-guide/master/ruby/.rubocop.yml
data/Gemfile CHANGED
@@ -1,5 +1,15 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in invoca-utils.gemspec
4
3
  gemspec
5
4
 
5
+ group :development do
6
+ gem 'bundler', '~> 1.6'
7
+ gem 'rake'
8
+ gem 'test-unit', '= 1.2.3'
9
+ gem 'rr', '=1.1.2'
10
+ gem 'shoulda', '= 3.5.0'
11
+ gem 'pry'
12
+ gem 'ruby-prof'
13
+ gem 'minitest'
14
+ gem 'tzinfo'
15
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- invoca-utils (0.0.3)
4
+ invoca-utils (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -53,4 +53,4 @@ DEPENDENCIES
53
53
  tzinfo
54
54
 
55
55
  BUNDLED WITH
56
- 1.16.0
56
+ 1.17.3
data/invoca-utils.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'invoca/utils/version'
@@ -17,14 +16,4 @@ Gem::Specification.new do |spec|
17
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.6"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "test-unit", "= 1.2.3"
24
- spec.add_development_dependency "rr", "=1.1.2"
25
- spec.add_development_dependency "shoulda", "= 3.5.0"
26
- spec.add_development_dependency "pry"
27
- spec.add_development_dependency "ruby-prof"
28
- spec.add_development_dependency "minitest"
29
- spec.add_development_dependency "tzinfo"
30
19
  end
data/lib/invoca/utils.rb CHANGED
@@ -11,3 +11,11 @@ module Invoca
11
11
  module Utils
12
12
  end
13
13
  end
14
+
15
+ unless defined?(Diff)
16
+ Diff = Invoca::Utils::Diff
17
+ end
18
+
19
+ unless defined?(Diffable)
20
+ Diffable = Invoca::Utils::Diffable
21
+ end
@@ -1,332 +1,340 @@
1
1
  # adapted from http://users.cybercity.dk/~dsl8950/ruby/diff-0.3.tar.gz
2
2
 
3
- class Diff
4
-
5
- VERSION = 0.3
6
-
7
- def self.lcs(a, b)
8
- astart = 0
9
- bstart = 0
10
- afinish = a.length-1
11
- bfinish = b.length-1
12
- lcs = []
13
-
14
- # First we prune off any common elements at the beginning
15
- while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart])
16
- lcs[astart] = bstart
17
- astart += 1
18
- bstart += 1
19
- end
3
+ module Invoca
4
+ module Utils
5
+ class Diff
6
+
7
+ VERSION = 0.3
8
+
9
+ def self.lcs(a, b)
10
+ astart = 0
11
+ bstart = 0
12
+ afinish = a.length - 1
13
+ bfinish = b.length - 1
14
+ lcs = []
15
+
16
+ # First we prune off any common elements at the beginning
17
+ while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart])
18
+ lcs[astart] = bstart
19
+ astart += 1
20
+ bstart += 1
21
+ end
20
22
 
21
- # now the end
22
- while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish])
23
- lcs[afinish] = bfinish
24
- afinish -= 1
25
- bfinish -= 1
26
- end
23
+ # now the end
24
+ while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish])
25
+ lcs[afinish] = bfinish
26
+ afinish -= 1
27
+ bfinish -= 1
28
+ end
27
29
 
28
- bmatches = reverse_hash(b, bstart..bfinish)
29
- thresh = []
30
- links = []
31
-
32
- (astart..afinish).each { |aindex|
33
- aelem = a[aindex]
34
- next unless bmatches.has_key? aelem
35
- k = nil
36
- bmatches[aelem].reverse.each { |bindex|
37
- if k && (thresh[k] > bindex) && (thresh[k-1] < bindex)
38
- thresh[k] = bindex
39
- else
40
- k = replacenextlarger(thresh, bindex, k)
30
+ bmatches = reverse_hash(b, bstart..bfinish)
31
+ thresh = []
32
+ links = []
33
+
34
+ (astart..afinish).each { |aindex|
35
+ aelem = a[aindex]
36
+ next unless bmatches.has_key? aelem
37
+ k = nil
38
+ bmatches[aelem].reverse.each { |bindex|
39
+ if k && (thresh[k] > bindex) && (thresh[k - 1] < bindex)
40
+ thresh[k] = bindex
41
+ else
42
+ k = replacenextlarger(thresh, bindex, k)
43
+ end
44
+ links[k] = [(k == 0) ? nil : links[k - 1], aindex, bindex] if k
45
+ }
46
+ }
47
+
48
+ if !thresh.empty?
49
+ link = links[thresh.length - 1]
50
+ while link
51
+ lcs[link[1]] = link[2]
52
+ link = link[0]
53
+ end
41
54
  end
42
- links[k] = [ (k==0) ? nil : links[k-1], aindex, bindex ] if k
43
- }
44
- }
45
-
46
- if !thresh.empty?
47
- link = links[thresh.length-1]
48
- while link
49
- lcs[link[1]] = link[2]
50
- link = link[0]
51
- end
52
- end
53
55
 
54
- return lcs
55
- end
56
+ return lcs
57
+ end
56
58
 
57
- def self.nested_compare( subtractions, additions, index )
58
- subtraction = subtractions[index]
59
- addition = additions[index]
60
- if subtraction.is_a?( Array ) && addition.is_a?( Array )
61
- return "Nested array diff:\n#{ compare( subtraction, addition ) }\n"
62
- elsif subtraction.is_a?( Hash ) && addition.is_a?( Hash )
63
- return "Nested hash diff:\n#{ compare( subtraction, addition ) }\n"
64
- else
65
- ""
66
- end
67
- end
59
+ def self.nested_compare(subtractions, additions, index)
60
+ subtraction = subtractions[index]
61
+ addition = additions[index]
62
+ if subtraction.is_a?(Array) && addition.is_a?(Array)
63
+ return "Nested array diff:\n#{ compare(subtraction, addition) }\n"
64
+ elsif subtraction.is_a?(Hash) && addition.is_a?(Hash)
65
+ return "Nested hash diff:\n#{ compare(subtraction, addition) }\n"
66
+ else
67
+ ""
68
+ end
69
+ end
68
70
 
69
- def self.format(value)
70
- value.is_a?(Numeric) || value.is_a?(String) ? value : value.inspect
71
- end
71
+ def self.format(value)
72
+ value.is_a?(Numeric) || value.is_a?(String) ? value : value.inspect
73
+ end
72
74
 
73
- def self.compare arg1, arg2, options={}
74
- result = ''
75
- if arg1 != arg2
76
- if arg1.class == arg2.class || (arg1.is_a?(Hash) && arg2.is_a?(Hash)) || (arg1.is_a?(Array) && arg2.is_a?(Array)) # Hash and Array are equivalent when specialized
77
- case arg1
78
- when Array
79
- diff_obj = Diff.new(arg1, arg2)
80
- summary = diff_obj.summary
81
- curr_diff = nil
82
- (arg1 + [nil]).each_with_index do |arg, index|
83
- if curr_diff.nil? || index > curr_diff[1].last
84
- curr_diff = summary.shift
85
- end
86
- unless curr_diff && (curr_diff[1].first..curr_diff[1].last) === index
87
- result << " #{format arg}\n" unless arg.nil? || options[:short_description]
88
- end
89
- if curr_diff && curr_diff[1].first == index
90
- verb, _a_range, _b_range, del, add = curr_diff
91
- result <<
92
- case verb
93
- when 'd'
94
- del.map { |t| "- #{format t}\n"}.join
95
- when 'a'
96
- add.map { |t| "+ #{format t}\n"}.join +
97
- (arg.nil? ? '' : " #{format arg}\n")
98
- when 'c'
99
- del.map_with_index { |t, del_index| "- #{format t}\n#{nested_compare(del, add, del_index)}" }.join +
100
- add.map { |t| "+ #{format t}\n" }.join
75
+ def self.compare arg1, arg2, options = {}
76
+ result = ''
77
+ if arg1 != arg2
78
+ if arg1.class == arg2.class || (arg1.is_a?(Hash) && arg2.is_a?(Hash)) || (arg1.is_a?(Array) && arg2.is_a?(Array)) # Hash and Array are equivalent when specialized
79
+ case arg1
80
+ when Array
81
+ diff_obj = Diff.new(arg1, arg2)
82
+ summary = diff_obj.summary
83
+ curr_diff = nil
84
+ (arg1 + [nil]).each_with_index do |arg, index|
85
+ if curr_diff.nil? || index > curr_diff[1].last
86
+ curr_diff = summary.shift
101
87
  end
102
- end
103
- end
104
- summary.empty? or raise "Summary left: #{summary.inspect}"
105
- when Hash
106
- arg1.each do |key, value|
107
- if arg2.has_key? key
108
- result += "[#{key.inspect}] #{compare value, arg2[key]};\n" if value != arg2[key]
88
+ unless curr_diff && (curr_diff[1].first..curr_diff[1].last) === index
89
+ result << " #{format arg}\n" unless arg.nil? || options[:short_description]
90
+ end
91
+ if curr_diff && curr_diff[1].first == index
92
+ verb, _a_range, _b_range, del, add = curr_diff
93
+ result <<
94
+ case verb
95
+ when 'd'
96
+ del.map { |t| "- #{format t}\n" }.join
97
+ when 'a'
98
+ add.map { |t| "+ #{format t}\n" }.join +
99
+ (arg.nil? ? '' : " #{format arg}\n")
100
+ when 'c'
101
+ del.map_with_index { |t, del_index| "- #{format t}\n#{nested_compare(del, add, del_index)}" }.join +
102
+ add.map { |t| "+ #{format t}\n" }.join
103
+ end
104
+ end
105
+ end
106
+ summary.empty? or raise "Summary left: #{summary.inspect}"
107
+ when Hash
108
+ arg1.each do |key, value|
109
+ if arg2.has_key? key
110
+ result += "[#{key.inspect}] #{compare value, arg2[key]};\n" if value != arg2[key]
111
+ else
112
+ result += "[#{key.inspect}] expected #{value.inspect}, was missing;\n"
113
+ end
114
+ end
115
+ (arg2.keys - arg1.keys).each do |key|
116
+ result += "[#{key.inspect}] not expected, was #{arg2[key].inspect};\n"
117
+ end
109
118
  else
110
- result += "[#{key.inspect}] expected #{value.inspect}, was missing;\n"
119
+ result = "expected #{arg1.inspect}, was #{arg2.inspect} "
111
120
  end
121
+ elsif arg1.class.in?([Float, BigDecimal]) && arg2.class.in?([Float, BigDecimal])
122
+ result = "expected #{arg1.class}: #{arg1.to_s}, was #{arg2.class}: #{arg2.to_s} "
123
+ else
124
+ result = "expected #{arg1.class}:#{arg1.inspect}, was #{arg2.class}:#{arg2.inspect} "
112
125
  end
113
- (arg2.keys - arg1.keys).each do |key|
114
- result += "[#{key.inspect}] not expected, was #{arg2[key].inspect};\n"
115
- end
116
- else
117
- result = "expected #{arg1.inspect}, was #{arg2.inspect} "
118
126
  end
119
- elsif arg1.class.in?([Float,BigDecimal]) && arg2.class.in?([Float,BigDecimal])
120
- result = "expected #{arg1.class}: #{arg1.to_s}, was #{arg2.class}: #{arg2.to_s} "
121
- else
122
- result = "expected #{arg1.class}:#{arg1.inspect}, was #{arg2.class}:#{arg2.inspect} "
127
+ result
123
128
  end
124
- end
125
- result
126
- end
127
129
 
128
130
 
129
- def makediff(a, b)
130
- lcs = self.class.lcs(a, b)
131
- ai = bi = 0
132
- while ai < lcs.length
133
- if lcs[ai]
134
- while bi < lcs[ai]
131
+ def makediff(a, b)
132
+ lcs = self.class.lcs(a, b)
133
+ ai = bi = 0
134
+ while ai < lcs.length
135
+ if lcs[ai]
136
+ while bi < lcs[ai]
137
+ discardb(bi, b[bi])
138
+ bi += 1
139
+ end
140
+ match
141
+ bi += 1
142
+ else
143
+ discarda(ai, a[ai])
144
+ end
145
+ ai += 1
146
+ end
147
+ while ai < a.length
148
+ discarda(ai, a[ai])
149
+ ai += 1
150
+ end
151
+ while bi < b.length
135
152
  discardb(bi, b[bi])
136
153
  bi += 1
137
154
  end
138
155
  match
139
- bi += 1
140
- else
141
- discarda(ai, a[ai])
142
156
  end
143
- ai += 1
144
- end
145
- while ai < a.length
146
- discarda(ai, a[ai])
147
- ai += 1
148
- end
149
- while bi < b.length
150
- discardb(bi, b[bi])
151
- bi += 1
152
- end
153
- match
154
- end
155
157
 
156
- def compact!
157
- diffs = []
158
- @diffs.each do |diff|
159
- puts "compacting #{diff.inspect}"
160
- i = 0
161
- curdiff = []
162
- while i < diff.length
163
- action = diff[i][0]
164
- s = @difftype.is_a?(String) ? diff[i][2,1] : [diff[i][2]]
165
- offset = diff[i][1]
166
- last = offset
167
- i += 1
168
- while diff[i] && diff[i][0] == action && diff[i][1] == last+1
169
- s << diff[i][2]
170
- last = diff[i][1]
171
- i += 1
158
+ def compact!
159
+ diffs = []
160
+ @diffs.each do |diff|
161
+ puts "compacting #{diff.inspect}"
162
+ i = 0
163
+ curdiff = []
164
+ while i < diff.length
165
+ action = diff[i][0]
166
+ s = @difftype.is_a?(String) ? diff[i][2, 1] : [diff[i][2]]
167
+ offset = diff[i][1]
168
+ last = offset
169
+ i += 1
170
+ while diff[i] && diff[i][0] == action && diff[i][1] == last + 1
171
+ s << diff[i][2]
172
+ last = diff[i][1]
173
+ i += 1
174
+ end
175
+ curdiff.push [action, offset, s]
176
+ end
177
+ diffs.push curdiff
172
178
  end
173
- curdiff.push [action, offset, s]
179
+ @diffs = diffs
180
+ self
174
181
  end
175
- diffs.push curdiff
176
- end
177
- @diffs = diffs
178
- self
179
- end
180
182
 
181
- def compact
182
- result = self.dup
183
- result.compact!
184
- result
185
- end
183
+ def compact
184
+ result = self.dup
185
+ result.compact!
186
+ result
187
+ end
186
188
 
187
- def summary
188
- result = []
189
- b_offset = 0
190
- @diffs.each do |block|
191
- del = []
192
- add = []
193
- block.each do |diff|
194
- case diff[0]
195
- when "-"
196
- del << diff[2]
197
- when "+"
198
- add << diff[2]
189
+ def summary
190
+ result = []
191
+ b_offset = 0
192
+ @diffs.each do |block|
193
+ del = []
194
+ add = []
195
+ block.each do |diff|
196
+ case diff[0]
197
+ when "-"
198
+ del << diff[2]
199
+ when "+"
200
+ add << diff[2]
201
+ end
202
+ end
203
+ first = block[0][1]
204
+ verb, a_range, b_range =
205
+ if del.empty?
206
+ ['a', [first - b_offset, first - b_offset], [first, first + add.size - 1]]
207
+ elsif add.empty?
208
+ ['d', [first, first + del.size - 1], [first + b_offset, first + b_offset]]
209
+ else
210
+ ['c', [first, first + del.size - 1], [first + b_offset, first + b_offset + add.size - 1]]
211
+ end
212
+ b_offset = b_offset + add.size - del.size
213
+ result << [verb, a_range, b_range, del, add]
199
214
  end
215
+ result
200
216
  end
201
- first = block[0][1]
202
- verb, a_range, b_range =
203
- if del.empty?
204
- [ 'a', [first-b_offset,first-b_offset], [first, first+add.size-1] ]
205
- elsif add.empty?
206
- [ 'd', [first, first+del.size-1], [first+b_offset, first+b_offset] ]
207
- else
208
- [ 'c', [first, first+del.size-1], [first+b_offset, first+b_offset+add.size-1] ]
209
- end
210
- b_offset = b_offset + add.size - del.size
211
- result << [verb, a_range, b_range, del, add]
212
- end
213
- result
214
- end
215
217
 
216
- attr_reader :diffs, :difftype
218
+ attr_reader :diffs, :difftype
217
219
 
218
- def initialize(a, b)
219
- @difftype = a.class
220
- @diffs = []
221
- @curdiffs = []
222
- makediff(a, b)
223
- end
224
-
225
- def match
226
- @diffs << @curdiffs unless @curdiffs.empty?
227
- @curdiffs = []
228
- end
229
-
230
- def discarda(i, elem)
231
- @curdiffs.push ['-', i, elem]
232
- end
220
+ def initialize(a, b)
221
+ @difftype = a.class
222
+ @diffs = []
223
+ @curdiffs = []
224
+ makediff(a, b)
225
+ end
233
226
 
234
- def discardb(i, elem)
235
- @curdiffs.push ['+', i, elem]
236
- end
227
+ def match
228
+ @diffs << @curdiffs unless @curdiffs.empty?
229
+ @curdiffs = []
230
+ end
237
231
 
238
- def inspect
239
- @diffs.inspect
240
- end
232
+ def discarda(i, elem)
233
+ @curdiffs.push ['-', i, elem]
234
+ end
241
235
 
242
- # Create a hash that maps elements of the array to arrays of indices
243
- # where the elements are found.
244
-
245
- def self.reverse_hash(lhs, range = nil)
246
- range ||= (0...lhs.length)
247
- revmap = {}
248
- range.each { |i|
249
- elem = lhs[i]
250
- if revmap.has_key? elem
251
- revmap[elem].push i
252
- else
253
- revmap[elem] = [i]
236
+ def discardb(i, elem)
237
+ @curdiffs.push ['+', i, elem]
254
238
  end
255
- }
256
- return revmap
257
- end
258
239
 
259
- def self.replacenextlarger(lhs, value, high = nil)
260
- high ||= lhs.length
261
- if lhs.empty? || value > lhs[-1]
262
- lhs.push value
263
- return high
264
- end
265
- # binary search for replacement point
266
- low = 0
267
- while low < high
268
- index = (high+low)/2
269
- found = lhs[index]
270
- return nil if value == found
271
- if value > found
272
- low = index + 1
273
- else
274
- high = index
240
+ def inspect
241
+ @diffs.inspect
275
242
  end
276
- end
277
243
 
278
- lhs[low] = value
279
- # $stderr << "replace #{value} : 0/#{low}/#{init_high} (#{steps} steps) (#{init_high-low} off )\n"
280
- # $stderr.puts lhs.inspect
281
- #gets
282
- #p length - low
283
- return low
284
- end
244
+ # Create a hash that maps elements of the array to arrays of indices
245
+ # where the elements are found.
246
+
247
+ def self.reverse_hash(lhs, range = nil)
248
+ range ||= (0...lhs.length)
249
+ revmap = {}
250
+ range.each { |i|
251
+ elem = lhs[i]
252
+ if revmap.has_key? elem
253
+ revmap[elem].push i
254
+ else
255
+ revmap[elem] = [i]
256
+ end
257
+ }
258
+ return revmap
259
+ end
285
260
 
286
- def self.patch(lhs, diff)
287
- newary = nil
288
- if diff.difftype == String
289
- newary = diff.difftype.new('')
290
- else
291
- newary = diff.difftype.new
292
- end
293
- ai = 0
294
- bi = 0
295
- diff.diffs.each { |d|
296
- d.each { |mod|
297
- case mod[0]
298
- when '-'
299
- while ai < mod[1]
300
- newary << lhs[ai]
301
- ai += 1
302
- bi += 1
261
+ def self.replacenextlarger(lhs, value, high = nil)
262
+ high ||= lhs.length
263
+ if lhs.empty? || value > lhs[-1]
264
+ lhs.push value
265
+ return high
266
+ end
267
+ # binary search for replacement point
268
+ low = 0
269
+ while low < high
270
+ index = (high + low) / 2
271
+ found = lhs[index]
272
+ return nil if value == found
273
+ if value > found
274
+ low = index + 1
275
+ else
276
+ high = index
303
277
  end
278
+ end
279
+
280
+ lhs[low] = value
281
+ # $stderr << "replace #{value} : 0/#{low}/#{init_high} (#{steps} steps) (#{init_high-low} off )\n"
282
+ # $stderr.puts lhs.inspect
283
+ #gets
284
+ #p length - low
285
+ return low
286
+ end
287
+
288
+ def self.patch(lhs, diff)
289
+ newary = nil
290
+ if diff.difftype == String
291
+ newary = diff.difftype.new('')
292
+ else
293
+ newary = diff.difftype.new
294
+ end
295
+ ai = 0
296
+ bi = 0
297
+ diff.diffs.each { |d|
298
+ d.each { |mod|
299
+ case mod[0]
300
+ when '-'
301
+ while ai < mod[1]
302
+ newary << lhs[ai]
303
+ ai += 1
304
+ bi += 1
305
+ end
306
+ ai += 1
307
+ when '+'
308
+ while bi < mod[1]
309
+ newary << lhs[ai]
310
+ ai += 1
311
+ bi += 1
312
+ end
313
+ newary << mod[2]
314
+ bi += 1
315
+ else
316
+ raise "Unknown diff action"
317
+ end
318
+ }
319
+ }
320
+ while ai < lhs.length
321
+ newary << lhs[ai]
304
322
  ai += 1
305
- when '+'
306
- while bi < mod[1]
307
- newary << lhs[ai]
308
- ai += 1
309
- bi += 1
310
- end
311
- newary << mod[2]
312
323
  bi += 1
313
- else
314
- raise "Unknown diff action"
315
324
  end
316
- }
317
- }
318
- while ai < lhs.length
319
- newary << lhs[ai]
320
- ai += 1
321
- bi += 1
325
+ return newary
326
+ end
322
327
  end
323
- return newary
324
328
  end
325
329
  end
326
330
 
327
- module Diffable
328
- def diff(b)
329
- Diff.new(self, b)
331
+ module Invoca
332
+ module Utils
333
+ module Diffable
334
+ def diff(b)
335
+ Diff.new(self, b)
336
+ end
337
+ end
330
338
  end
331
339
  end
332
340