emittable 0.1.2 → 0.2.0

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
  SHA256:
3
- metadata.gz: 65d75cbf788c4c6ec08f040683b55a14f388328b22bfa46bee708e523bdcbd10
4
- data.tar.gz: 24d6e8a81af4bf58537ad340d444529ffecfa6eea929d5962a0a645cf1605fe2
3
+ metadata.gz: becd44347409d49fe0f73a082a20c08ea032b3e253fca344eb614ca7a0206e52
4
+ data.tar.gz: 137a50fcb16470a87632aaf77fd10134d91bda5002bd5b1dc0b5ff3a05db3a6f
5
5
  SHA512:
6
- metadata.gz: f7172733b45cc88e56b4610b9dd9f15e89ebdc790708e3faf04e941bce702f62bf53f3f762109b9d40140437dc122fd809a553bd32279247d3dc1d758ee74935
7
- data.tar.gz: fd2b0f4bffe1b33752eacaa945b7683dc204b23ba1ddf58d9a9f846977f0695f554af7fe5842dad854643ef174f7dd8d5445e67e0c1086e891e60d9769aac677
6
+ metadata.gz: fb07ffc34c3e8f33627f87e5db21cc1fec5dcc445583fb63f343de1c5663fe05fa8886415b976560e17ad9509d7d0fe3d15335c28e2c18ced435b68651a9c7f6
7
+ data.tar.gz: 76303e7190a6211b173121e5d2ed3c8d96c8614e0494d511cf0667099de9556d22f095dc6947c405704e00a1a4e79c3dafddc14763c4c33af5a41a60b884f3a4
@@ -55,9 +55,8 @@ module Emittable
55
55
  event_name = event_name.to_s
56
56
  callbacks = nil
57
57
  @emittable_mutex.synchronize do
58
- callbacks = @emittable_events[event_name]
59
- raise Error, 'no callbacks found for that event' unless callbacks
60
- callbacks = callbacks.dup
58
+ callbacks = @emittable_events[event_name].to_a
59
+ callbacks = callbacks.dup # in case the array changes as we are iterating through the callbacks
61
60
  end
62
61
  # we are outside of the mutex so any callbacks are able to trigger an event from
63
62
  # this class without deadlock
@@ -61,12 +61,14 @@ RSpec.describe Emittable do
61
61
  end
62
62
 
63
63
  context "after removing a callback" do
64
- it "should sould raise error" do
65
- callback = proc {}
64
+ it "should sould not call it" do
65
+ $test = 0
66
+ callback = proc { $test += 1 }
66
67
  @a.on(:event, &callback)
67
68
  @a.trigger(:event)
68
69
  @a.off(:event, callback)
69
- expect{ @a.trigger(:event) }.to raise_error(Emittable::Error)
70
+ @a.trigger(:event)
71
+ expect($test).to eql 1
70
72
  end
71
73
  end
72
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emittable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Fors