collection_of 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjcwOTY5N2JlNzAyYjc5ZDU2M2EwMTc1OWFmOGZiNTYzNGU3OGY2Mg==
4
+ NTI4NDIzNzJiYjE1MThhZDY5MjhlNjVkZDM1NDBhMDc1ZTg1Yjg4MQ==
5
5
  data.tar.gz: !binary |-
6
- MGRjOWE1ZmNmNjI4ZDc1ZTU0ODMwMjA1ZGNjZTZlNjBlYTVkMjg1OQ==
6
+ NTAxZjZiMjg4NzkxZTI3ZTgxNmFiMGI0ODhhNTlmNTJlZWEwMWQ2Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWI2ZmY5NTVmZWI5YjYwYTM5YTcwNzg3YmUwNjA0ZDg2NjE2ODgwY2M4MWI0
10
- YzQzN2YzNTdmYTkzYmZiN2Y3MjI5NGY3Mjg5M2UxOWU3ODJlOGZjYTU1Y2Yw
11
- MDZmNDFjOGIyMTE5MTU2Y2VkNjhkN2VjM2ZlZjEwM2YwZGM3Yjk=
9
+ OTMzYWU5NjdkNGQ2NmFjYjMyNTQ4MmQ3YjRmYzFkMjVlZTFlZGZiMzY1YTRl
10
+ ZTBkOTBjNmZhNGQxZTVhOTljZGZiZWYxMmIwZGE4ZWFkMmIwY2JhZjQzNDRh
11
+ ODE5N2VhZThlMzQzNDYxYjI1ODliNzViMDliMTdkNDE1ODExYTg=
12
12
  data.tar.gz: !binary |-
13
- NzYzYTdkZmJkODE1MGU2MTFiZTU3ZThhNWM2Mjk2YjEzNzQyMTc2ODc4ODg1
14
- OTI0YjdhYmJmZjhmZjM0MGZlMzI1Nzg2ZjQ5NmE2MGZmMDEzMDczNjFhMWJj
15
- NjFhNWIxZmI3MzcxY2NlNmE3MDEzODIzMzhmY2I4NjVkNTBmMmQ=
13
+ NzNjMDE3YjY3ZjdhM2M0Y2E5NzA3NzRhNThkMWFiMWRjMDdmMDVkNTA2YjA3
14
+ OGQ4NTYwNDEwZmY0MGE5YzAxOTYxYmU0MDFmMTRmZTAyZjZlMjUzOWUzZGNj
15
+ OTk1ZjhmODI0Y2MwNDM5MzI4ZWMxNzIyZGEwODQ2NjY3YTIxZmI=
@@ -76,6 +76,10 @@ class Collection
76
76
  self.class.new(klass, select{ |i| items.include?(i.name.to_sym) })
77
77
  end
78
78
 
79
+ def delete(*items)
80
+ @collection = reject{ |i| items.include?(i.name) }
81
+ end
82
+
79
83
  def ==(other)
80
84
  return other == @collection if other.is_a?(self.class)
81
85
  return @collection == other if other.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module CollectionOf
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -244,4 +244,29 @@ describe Collection do
244
244
  it { should_not == described_class[Widget, [w2]] }
245
245
  it { should_not == described_class[Widget] }
246
246
  end
247
+
248
+ describe "#delete" do
249
+ let(:c) { described_class[Widget] }
250
+ let(:w1) { Widget.new(:one) }
251
+ let(:w2) { Widget.new(:two) }
252
+
253
+ subject { c }
254
+
255
+ before { c << w1 << w2 }
256
+
257
+ context "when an included item is specified" do
258
+ before { c.delete(:one) }
259
+ it { should == [w2] }
260
+ end
261
+
262
+ context "when all included items are specified" do
263
+ before { c.delete(:one, :two) }
264
+ it { should be_empty }
265
+ end
266
+
267
+ context "when no included items are specified" do
268
+ before { c.delete(:three) }
269
+ it { should == [w1, w2] }
270
+ end
271
+ end
247
272
  end
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
4
+ version: 1.0.5
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-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  type: :runtime