event-bus 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +3 -0
- data/.rubocop.yml +23 -0
- data/.simplecov +8 -0
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +61 -0
- data/Gemfile +33 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +34 -0
- data/cucumber.yml +2 -0
- data/event-bus.gemspec +23 -0
- data/fixtures/simple_app/bin/simple_app +7 -0
- data/fixtures/simple_app/features/support/env.rb +1 -0
- data/fixtures/simple_app/lib/simple_app.rb +6 -0
- data/fixtures/simple_app/lib/simple_app/version.rb +5 -0
- data/fixtures/simple_app/simple_app.gemspec +24 -0
- data/fixtures/simple_app/spec/simple_app_spec.rb +11 -0
- data/fixtures/simple_app/spec/spec_helper.rb +2 -0
- data/lib/event/bus.rb +37 -0
- data/lib/event/bus/version.rb +7 -0
- data/lib/event/errors.rb +5 -0
- data/lib/event/name_resolver.rb +65 -0
- data/script/console +7 -0
- data/script/setup +7 -0
- data/script/test +3 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0acc21d9d8537e3f35b313333a293649a0c4aeb4
|
4
|
+
data.tar.gz: ba114e08659603bda5d5d0b0be739d0f244be7a2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 939ddf5539f90fb5298bf4d741408e2a36cf5d6277fd9b30851b602487b1c349090bc84217ef22cba30a2b263f18c340e259b2937f918168814d8a3737f9eece
|
7
|
+
data.tar.gz: 2da980710a514e0bb75f7befccb5f044017cb5e5d85a7a43eb65484bc1c2549ca9b16770bfbb9fa5ee1adee166f033b200ad26e08ce2f768ff5793fa01f177e5
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'tmp/**/*'
|
4
|
+
DisplayCopNames: true
|
5
|
+
|
6
|
+
Metrics/LineLength:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Exclude:
|
11
|
+
- lib/event/name_resolver.rb
|
12
|
+
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Exclude:
|
15
|
+
- lib/event/name_resolver.rb
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Exclude:
|
19
|
+
- lib/event/name_resolver.rb
|
20
|
+
|
21
|
+
Metrics/PerceivedComplexity:
|
22
|
+
Exclude:
|
23
|
+
- lib/event/name_resolver.rb
|
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
4
|
+
improve this project.
|
5
|
+
|
6
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
7
|
+
|
8
|
+
Here are some ways *you* can contribute:
|
9
|
+
|
10
|
+
* by using alpha, beta, and prerelease versions
|
11
|
+
* by reporting bugs
|
12
|
+
* by suggesting new features
|
13
|
+
* by writing or editing documentation
|
14
|
+
* by writing specifications
|
15
|
+
* by writing code ( **no patch is too small** : fix typos, add comments, clean up inconsistent whitespace )
|
16
|
+
* by refactoring code
|
17
|
+
* by closing [issues][]
|
18
|
+
* by reviewing patches
|
19
|
+
|
20
|
+
[issues]: https://github.com/cucumber/event-bus/issues
|
21
|
+
|
22
|
+
## Submitting an Issue
|
23
|
+
|
24
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
25
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
26
|
+
already been submitted.
|
27
|
+
|
28
|
+
When submitting a bug report, please include a [Gist][] that includes a *stack
|
29
|
+
trace* and any details that may be necessary to reproduce the bug, including
|
30
|
+
your *gem version*, *Ruby version*, and *operating system*. Ideally, a bug report
|
31
|
+
should include a pull request with failing specs.
|
32
|
+
|
33
|
+
[gist]: https://gist.github.com/
|
34
|
+
|
35
|
+
## Submitting a Pull Request
|
36
|
+
|
37
|
+
1. [Fork the repository.][fork]
|
38
|
+
2. Create a topic [branch]. `git checkout -b local_topic_branch`
|
39
|
+
3. Add specs for your unimplemented feature or bug fix.
|
40
|
+
4. Run `bundle exec rake test`. If your specs pass, return to step 3.
|
41
|
+
5. Implement your feature or bug fix.
|
42
|
+
6. Run `bundle exec rake test`. If your specs fail, return to step 5.
|
43
|
+
7. Add, commit, and push your changes. To push your topic branch use `git push -u origin local_topic_branch`.
|
44
|
+
8. [Submit a pull request.][pr]
|
45
|
+
|
46
|
+
Here are some reasons why a pull request may not be merged:
|
47
|
+
|
48
|
+
1. It hasn’t been reviewed.
|
49
|
+
2. It doesn’t include specs for new functionality.
|
50
|
+
3. It doesn’t include documentation for new functionality.
|
51
|
+
4. It changes behavior without changing the relevant documentation, comments, or specs.
|
52
|
+
5. It changes behavior of an existing public API, breaking backward compatibility.
|
53
|
+
6. It breaks the tests on a supported platform.
|
54
|
+
7. It doesn’t merge cleanly (requiring Git rebasing and conflict resolution).
|
55
|
+
|
56
|
+
Include this emoji in the top of your ticket to signal to us that you read this
|
57
|
+
file: :memo:
|
58
|
+
|
59
|
+
[fork]: http://help.github.com/fork-a-repo/
|
60
|
+
[branch]: https://help.github.com/articles/fork-a-repo#create-branches
|
61
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/Gemfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in event-bus.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :debug do
|
7
|
+
gem 'pry'
|
8
|
+
gem 'byebug'
|
9
|
+
gem 'pry-doc', require: false
|
10
|
+
gem 'pry-byebug', require: false
|
11
|
+
end
|
12
|
+
|
13
|
+
group :development, :test do
|
14
|
+
gem 'aruba', '~>0.10.0', require: false
|
15
|
+
gem 'awesome_print', require: 'ap'
|
16
|
+
gem 'coveralls', require: false
|
17
|
+
gem 'cucumber', require: false
|
18
|
+
gem 'fuubar', require: false
|
19
|
+
gem 'github-markup'
|
20
|
+
gem 'inch', require: false
|
21
|
+
gem 'license_finder'
|
22
|
+
gem 'rake', '~>10.0.0', require: false
|
23
|
+
gem 'rubocop', require: false
|
24
|
+
gem 'simplecov', require: false
|
25
|
+
gem 'tmrb', require: false
|
26
|
+
gem 'versionomy', require: false
|
27
|
+
gem 'yard', require: false
|
28
|
+
gem 'rspec', require: false
|
29
|
+
end
|
30
|
+
|
31
|
+
group :profile do
|
32
|
+
gem 'ruby-prof'
|
33
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dennis Günnewig
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dennis Günnewig
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Event Bus
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/cucumber/event-bus.svg?branch=master)](https://travis-ci.org/cucumber/event-bus)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/cucumber/event-bus.svg)](https://codeclimate.com/github/cucumber/event-bus)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/cucumber/event-bus/badge.svg?branch=master)](https://coveralls.io/r/cucumber/event-bus?branch=master)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/event-bus.svg)](http://badge.fury.io/rb/proxy_pac_rb)
|
7
|
+
[![Downloads](http://img.shields.io/gem/dt/event-bus.svg?style=flat)](http://rubygems.org/gems/proxy_pac_rb)
|
8
|
+
|
9
|
+
|
10
|
+
This gem helps you to setup an event bus for your library.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'event-bus'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install event-bus
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Please have a look at [features/bus.feature](https://github.com/cucumber/event-bus/blob/master/features/bus.feature) for an
|
31
|
+
example application.
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `script/setup` to install dependencies. Then, run
|
36
|
+
`rake spec` to run the tests. You can also run `script/console` for an interactive
|
37
|
+
prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at
|
44
|
+
https://github.com/cucumber/event-bus. This project is intended to be a
|
45
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
46
|
+
adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
47
|
+
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
The gem is available as open source under the terms of the [MIT
|
52
|
+
License](http://opensource.org/licenses/MIT).
|
53
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'Default task'
|
8
|
+
task default: :test
|
9
|
+
|
10
|
+
require 'coveralls/rake/task'
|
11
|
+
Coveralls::RakeTask.new
|
12
|
+
|
13
|
+
desc 'Run test suite'
|
14
|
+
task test: %w(test:rubocop test:rspec test:cucumber)
|
15
|
+
|
16
|
+
namespace :test do
|
17
|
+
desc 'Test with coveralls'
|
18
|
+
task coveralls: %w(test coveralls:push)
|
19
|
+
|
20
|
+
desc 'Run rspec'
|
21
|
+
task :rspec do
|
22
|
+
sh 'bundle exec rspec'
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Run cucumber'
|
26
|
+
task :cucumber do
|
27
|
+
sh 'bundle exec cucumber'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Run cucumber'
|
31
|
+
task :rubocop do
|
32
|
+
sh 'bundle exec rubocop'
|
33
|
+
end
|
34
|
+
end
|
data/cucumber.yml
ADDED
data/event-bus.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'event/bus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'event-bus'
|
8
|
+
spec.version = Event::Bus::VERSION
|
9
|
+
spec.authors = ['Dennis Günnewig']
|
10
|
+
spec.email = ['dg1@ratiodata.de']
|
11
|
+
|
12
|
+
spec.summary = 'Notify subscribers about event'
|
13
|
+
spec.description = 'This gem notifies subscribers about event'
|
14
|
+
spec.homepage = 'https://github.com/cucumber/event-bus'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba/cucumber'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'simple_app/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'simple_app'
|
8
|
+
spec.version = SimpleApp::VERSION
|
9
|
+
spec.authors = ['Example Author']
|
10
|
+
spec.email = ['mail@example.org']
|
11
|
+
|
12
|
+
spec.summary = 'Simple App'
|
13
|
+
spec.description = 'This is a simple app'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
end
|
data/lib/event/bus.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'event/name_resolver'
|
2
|
+
require 'event/errors'
|
3
|
+
|
4
|
+
module Event
|
5
|
+
# Event bus
|
6
|
+
#
|
7
|
+
# Implements and in-process pub-sub events broadcaster allowing multiple observers
|
8
|
+
# to subscribe to different events that fire as your tests are executed.
|
9
|
+
#
|
10
|
+
class Bus
|
11
|
+
def initialize(resolver)
|
12
|
+
@resolver = resolver
|
13
|
+
@handlers = Hash.new { |h, k| h[k] = [] }
|
14
|
+
end
|
15
|
+
|
16
|
+
# Register for an event
|
17
|
+
def register(event_id, handler_object = nil, &handler_proc)
|
18
|
+
handler = handler_proc || handler_object
|
19
|
+
|
20
|
+
fail ArgumentError, 'Please pass either an object#call or a handler block' if handler.nil? || !handler.respond_to?(:call)
|
21
|
+
|
22
|
+
event_class = @resolver.transform(event_id)
|
23
|
+
|
24
|
+
fail EventNameResolveError, %(Transforming "#{event_id}" into an event name failed for unknown reason.) if event_class.nil?
|
25
|
+
@handlers[event_class.to_s] << handler
|
26
|
+
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
# Broadcast an event
|
31
|
+
def notify(event)
|
32
|
+
fail NoEventError, 'Please pass an event object, not a class' if event.is_a?(Class)
|
33
|
+
|
34
|
+
@handlers[event.class.to_s].each { |handler| handler.call(event) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/event/errors.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'event/errors'
|
2
|
+
|
3
|
+
# Event notification library
|
4
|
+
module Event
|
5
|
+
# Resolve name to Event name
|
6
|
+
class NameResolver
|
7
|
+
def initialize(default_namespace)
|
8
|
+
@default_namespace = default_namespace
|
9
|
+
end
|
10
|
+
|
11
|
+
def transform(event_id)
|
12
|
+
case event_id
|
13
|
+
when Class
|
14
|
+
event_id
|
15
|
+
when String
|
16
|
+
constantize(event_id)
|
17
|
+
else
|
18
|
+
constantize("#{@default_namespace}::#{camel_case(event_id)}")
|
19
|
+
end
|
20
|
+
rescue => e
|
21
|
+
raise EventNameResolveError, %(Transforming "#{event_id}" into an event class failed: #{e.message}.)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def camel_case(underscored_name)
|
27
|
+
underscored_name.to_s.split('_').map { |word| word.upcase[0] + word[1..-1] }.join
|
28
|
+
end
|
29
|
+
|
30
|
+
# Thanks ActiveSupport
|
31
|
+
# (Only needed to support Ruby 1.9.3 and JRuby)
|
32
|
+
def constantize(camel_cased_word)
|
33
|
+
names = camel_cased_word.split('::')
|
34
|
+
|
35
|
+
# Trigger a built-in NameError exception including the ill-formed constant in the message.
|
36
|
+
Object.const_get(camel_cased_word) if names.empty?
|
37
|
+
|
38
|
+
# Remove the first blank element in case of '::ClassName' notation.
|
39
|
+
names.shift if names.size > 1 && names.first.empty?
|
40
|
+
|
41
|
+
names.inject(Object) do |constant, name|
|
42
|
+
if constant == Object
|
43
|
+
constant.const_get(name)
|
44
|
+
else
|
45
|
+
candidate = constant.const_get(name)
|
46
|
+
next candidate if constant.const_defined?(name, false)
|
47
|
+
next candidate unless Object.const_defined?(name)
|
48
|
+
|
49
|
+
# Go down the ancestors to check if it is owned directly. The check
|
50
|
+
# stops when we reach Object or the end of ancestors tree.
|
51
|
+
# rubocop:disable Style/EachWithObject
|
52
|
+
constant = constant.ancestors.inject do |const, ancestor|
|
53
|
+
break const if ancestor == Object
|
54
|
+
break ancestor if ancestor.const_defined?(name, false)
|
55
|
+
const
|
56
|
+
end
|
57
|
+
# rubocop:enable Style/EachWithObject
|
58
|
+
|
59
|
+
# owner is in Object, so raise
|
60
|
+
constant.const_get(name, false)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/script/console
ADDED
data/script/setup
ADDED
data/script/test
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: event-bus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dennis Günnewig
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
description: This gem notifies subscribers about event
|
28
|
+
email:
|
29
|
+
- dg1@ratiodata.de
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".rubocop.yml"
|
37
|
+
- ".simplecov"
|
38
|
+
- ".travis.yml"
|
39
|
+
- CODE_OF_CONDUCT.md
|
40
|
+
- CONTRIBUTING.md
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE
|
43
|
+
- LICENSE.txt
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- cucumber.yml
|
47
|
+
- event-bus.gemspec
|
48
|
+
- fixtures/simple_app/bin/simple_app
|
49
|
+
- fixtures/simple_app/features/support/env.rb
|
50
|
+
- fixtures/simple_app/lib/simple_app.rb
|
51
|
+
- fixtures/simple_app/lib/simple_app/version.rb
|
52
|
+
- fixtures/simple_app/simple_app.gemspec
|
53
|
+
- fixtures/simple_app/spec/simple_app_spec.rb
|
54
|
+
- fixtures/simple_app/spec/spec_helper.rb
|
55
|
+
- lib/event/bus.rb
|
56
|
+
- lib/event/bus/version.rb
|
57
|
+
- lib/event/errors.rb
|
58
|
+
- lib/event/name_resolver.rb
|
59
|
+
- script/console
|
60
|
+
- script/setup
|
61
|
+
- script/test
|
62
|
+
homepage: https://github.com/cucumber/event-bus
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.4.5.1
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Notify subscribers about event
|
86
|
+
test_files: []
|
87
|
+
has_rdoc:
|