collection_of 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/collection_of.rb +1 -1
- data/lib/collection_of/collection.rb +5 -0
- data/lib/collection_of/version.rb +1 -1
- data/spec/collection_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTUzMGY4NTExZjJkOGU1NGUwZmFhNTU5NGY3NTA0YjZjZDQxOTNkYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2UzZjFhMTA5M2ZiYTFhOTUwMWI4ZjA5ODRkN2E2NTAxOTI5Zjc5MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjRlZGY4MTllODBiZDgyY2I5ODhiNDcxMjI1ZDFjZDE5MTAyZTJlNWQ5NGQx
|
10
|
+
MjcyNzAwNmU2NzU3NjNjMjYxMzg2NmQyNTNhMThmNmM4MmZhYzRkZWYyZjlm
|
11
|
+
ZDE0Yjc1MDcxZTcyNjdkZTA3MDQzZjgwZDY4MjZlZDJiNTA4MmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTQ1NDRkMWIyZWVhNmQ1YTZkNjQyMTU3NDM5NDI4MDc5YTMwNWU2NzU1ZDUw
|
14
|
+
MjIzNWNlZDllNTU2NjNhNGE5NTgxNTBjMjM2YzM2NjY5NmFlOGNkNmEwZjI3
|
15
|
+
MDM4MGExOGQwZWE3Yzg3NTk2MzAwMjI1MGM0MDY0YTAxOTdhZGI=
|
data/lib/collection_of.rb
CHANGED
@@ -55,6 +55,11 @@ class Collection
|
|
55
55
|
@collection.map{ |i| i.name.to_sym }
|
56
56
|
end
|
57
57
|
|
58
|
+
def key?(key)
|
59
|
+
keys.include?(key.to_sym)
|
60
|
+
end
|
61
|
+
alias_method :has_key?, :key?
|
62
|
+
|
58
63
|
def include?(item)
|
59
64
|
return true if @collection.include?(item)
|
60
65
|
return keys.include?(item.to_sym) if item.respond_to?(:to_sym)
|
data/spec/collection_spec.rb
CHANGED
@@ -153,6 +153,16 @@ describe Collection do
|
|
153
153
|
its(:keys) { should == [:one, :two] }
|
154
154
|
end
|
155
155
|
|
156
|
+
describe "#key?" do
|
157
|
+
let(:w1) { Widget.new(:one) }
|
158
|
+
subject { described_class[Widget] }
|
159
|
+
|
160
|
+
before { subject << w1 }
|
161
|
+
|
162
|
+
it { should have_key(:one) }
|
163
|
+
it { should_not have_key(:two) }
|
164
|
+
end
|
165
|
+
|
156
166
|
describe "#include?" do
|
157
167
|
let(:w1) { Widget.new(:one) }
|
158
168
|
let(:w2) { Widget.new(:one) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collection_of
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Vandersluis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
type: :runtime
|