church 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/church/array.rb CHANGED
@@ -101,7 +101,7 @@ module Church
101
101
  # Returns the index of the element within the collection, or nil if not found.
102
102
  INDEX = -> coll, elem {
103
103
  (indexer = -> i {
104
- coll[i] == elem ? i : i > SIZE[elem] ? nil : indexer[i + 1]
104
+ coll[i] == elem ? i : i > SIZE[coll] ? nil : indexer[i + 1]
105
105
  })[0]
106
106
  }
107
107
  end
@@ -1,3 +1,3 @@
1
1
  module Church
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/spec/array_spec.rb CHANGED
@@ -104,4 +104,9 @@ describe 'INDEX' do
104
104
  expect(INDEX['abc', 'b']).to be 1
105
105
  expect(INDEX['abc', 'd']).to be nil
106
106
  end
107
+
108
+ it "should find the indices of elements within arrays" do
109
+ expect(INDEX[[1, 2, 3], 3]).to be 2
110
+ expect(INDEX[[1, 2, 3], 4]).to be nil
111
+ end
107
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: church
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: