Class: Array
- Inherits:
-
Object
show all
- Defined in:
- lib/redshift/util/object-diff.rb
Instance Method Summary
collapse
Instance Method Details
#diff(other, &block) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/redshift/util/object-diff.rb', line 22
def diff other, &block
a = (0...[self.size, (other ? other.size : 0)].min).map do |i|
self[i].diff(other[i], &block)
end
if block
block.call a, other.size - self.size
end
a
end
|
#filter(&block) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/redshift/util/object-diff.rb', line 32
def filter(&block)
aa = inject([]) do |a, val|
v = val.filter(&block)
a << v if v
a
end
aa.empty? ? nil : aa
end
|