eventd 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/eventd.rb +17 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73d3d294cf56822b928463281bb0ad466abe0de5
4
+ data.tar.gz: 127b2e6476bd229a1d788b282bbef8655e6c2789
5
+ SHA512:
6
+ metadata.gz: a533058737df7dd30638fb25e55ec0fc7da00bfec54cfc28a2cdd270ad23175f639c9597ffd6eaf9be1a62df7d460806de379d2b1d10b00985c686aac10bcfdd
7
+ data.tar.gz: 78a14581e774dbee1c3c0349dbae8c623dc1dab490f2f735bfd7cd57fcc76fa6bc377d87b4a988901dc08b8ebd278c6068069ed9a4a977b796473685f11897f7
data/lib/eventd.rb ADDED
@@ -0,0 +1,17 @@
1
+ class Eventd
2
+ def initialize
3
+ @emitters = {}
4
+ end
5
+
6
+ def on(emitter_name, &callback)
7
+ (@emitters[emitter_name] = (@emitters[emitter_name] || [])).push callback
8
+ end
9
+
10
+ def off(emitter_name)
11
+ @emitters[emitter_name] = []
12
+ end
13
+
14
+ def emit(emitter_name, parameters = nil)
15
+ (@emitters[emitter_name] || []).each do |callback| callback.call parameters end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eventd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jesse Dunlap
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A quick architecture that can be used to add eventing support to any
14
+ object
15
+ email: me@jessedunlap.me
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/eventd.rb
21
+ homepage: ''
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Add eventing support to any object!
44
+ test_files: []