emittable 0.1.0 → 0.1.1
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 +5 -5
- data/README.md +7 -2
- data/lib/emittable.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 806e01078686ca927776047b462f1c4798518fd6096639bd08e52f4fae9689ad
|
4
|
+
data.tar.gz: dadbd08fe003248e0d04435c757638e856735c73f17f661703e2e4f17bb0b115
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92b38776594d2960ffeb95f6034c70e6c080d5c8a6226eb839c59d30b0295bbfc8e45c439d84ae85d4b674a7bcb5a60fb105055b82ad87f8e5bb67a4a8897eca
|
7
|
+
data.tar.gz: 2f380ac3192220a05dd8c2eb38fc3030b7d0704ce762d3ece6843101bd157a53321fc128f3855224fd74e525cdd52cf46be4db0dedded2d08e711b2bbd0af6dd
|
data/README.md
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
# Emittable
|
2
|
-
A Ruby Gem to register and trigger events. It is a clone of `Vienna::Emittable`.
|
2
|
+
A Ruby Gem to register and trigger events. It is a clone of `Vienna::Emittable`. It is thread safe.
|
3
3
|
|
4
4
|
# Install
|
5
5
|
`gem install emittable`
|
6
6
|
|
7
7
|
# Example
|
8
|
-
First `require 'emittable'` in your project. Then you can `include` `Emittable` in your classes.
|
8
|
+
First `require 'emittable'` in your project. Then you can `include` `Emittable` in your classes. If you override `initialize` remember to call `super`.
|
9
9
|
```ruby
|
10
10
|
require 'emittable'
|
11
11
|
|
12
12
|
class A
|
13
13
|
include Emittable
|
14
14
|
|
15
|
+
def initialize(...)
|
16
|
+
...
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
15
20
|
...
|
16
21
|
...
|
17
22
|
|
data/lib/emittable.rb
CHANGED
@@ -4,6 +4,7 @@ require 'emittable/error'
|
|
4
4
|
module Emittable
|
5
5
|
|
6
6
|
def initialize(*args)
|
7
|
+
@emittable_setup = true
|
7
8
|
@emittable_events = {}
|
8
9
|
@emittable_mutex = Mutex.new
|
9
10
|
super
|
@@ -61,4 +62,11 @@ module Emittable
|
|
61
62
|
nil
|
62
63
|
end
|
63
64
|
|
65
|
+
private
|
66
|
+
|
67
|
+
def check_emittable_setup
|
68
|
+
raise Error, "has 'super' been called on including class?" unless @emittable_setup
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
|
64
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emittable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Fors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple event registering/triggering module to mix into classes.
|
14
14
|
email: mail@robfors.com
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.
|
45
|
+
rubygems_version: 2.7.6
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Event registering and triggering.
|