ma 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +17 -0
- data/.gitlab-ci.yml +14 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +114 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/keys/gem-public_cert.pem +20 -0
- data/keys/kris.leech.gpg.public +81 -0
- data/lib/ma.rb +12 -0
- data/lib/ma/event.rb +10 -0
- data/lib/ma/publisher.rb +17 -0
- data/lib/ma/subscriber.rb +24 -0
- data/lib/ma/version.rb +3 -0
- data/ma.gemspec +36 -0
- metadata +102 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c9303572209230462f38bd6ca4f63647ac5328e4c77e2afe31dfc0be4ebc9242
|
4
|
+
data.tar.gz: 1dae14d77b90a8ebd3bc5a68bc7cd6975eb515a1bced1ca06e3bd73acb7918b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f8438244784956e01bae108f113e3bb92d171d5c6a6119cdf25102c38cc4d2604a4d52f0495a606bd52bb70c52a3b6b84cf57aa9d19009b70de516c77cd1192
|
7
|
+
data.tar.gz: f2aca1653e51db2e13845f60d44986e871bf858457520639b2b3330cbb01df3546caf70602e023a4975694c376b913fad25cc92dd3d22e985b02a62d3739d804
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [0.1.0]
|
11
|
+
|
12
|
+
- Added: Ability for an object to publish events
|
13
|
+
- Added: Ability for an object to subscribe to events
|
14
|
+
- Added: Ability for subscriber to handle events async
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at kris.leech@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Kris Leech
|
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,114 @@
|
|
1
|
+
# Ma 間
|
2
|
+
|
3
|
+
> Ma (間) is a Japanese word which can be roughly translated as "gap", "space", "pause" or "the space between two structural parts."
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
class MyEvent < Ma::Event
|
9
|
+
end
|
10
|
+
|
11
|
+
class MyPublisher
|
12
|
+
include Ma.publisher
|
13
|
+
|
14
|
+
def call
|
15
|
+
# ...
|
16
|
+
broadcast(MyEvent.new(user: user))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class MyListener
|
21
|
+
include Ma.subscriber
|
22
|
+
|
23
|
+
on(MyEvent) do |event|
|
24
|
+
# ...
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
publisher = MyPublisher.new
|
29
|
+
publisher.subscribe(MyListener.new)
|
30
|
+
publisher.call
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Handling Events Asynchronously
|
34
|
+
|
35
|
+
Ma is build on top of [WisperNext](https://gitlab.com/kris.leech/wisper_next)
|
36
|
+
and as such can take advantage of the [async adapters](https://gitlab.com/kris.leech/wisper_next#handling-events-asynchronously).
|
37
|
+
|
38
|
+
Configure an adapter and then pass `:async` as such:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
class MyListener
|
42
|
+
include Ma.subscriber(:async)
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
### Event class
|
47
|
+
|
48
|
+
The event can be any object which is:
|
49
|
+
|
50
|
+
* initialized with a `Hash` of attributes
|
51
|
+
* responds to `#to_h` returning a `Hash`
|
52
|
+
|
53
|
+
We provide a simple Struct-like event object, `Ma::Event`, but would recommend using some
|
54
|
+
thing like [dry-struct](https://dry-rb.org/gems/dry-struct/1.0/) to define an
|
55
|
+
event schema.
|
56
|
+
|
57
|
+
A useful constraint, if you are using asynchronous listeners, is that
|
58
|
+
dry-struct only supports primative types like `String`, `Integer`, `Hash` and
|
59
|
+
`Array, which are easily serialized for transport over the wire to a background
|
60
|
+
worker.
|
61
|
+
|
62
|
+
#### Enhancing Events
|
63
|
+
|
64
|
+
You can add additional information to the payload by either overriding the
|
65
|
+
`#initialize` method:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
class MyEvent < Ma::Event
|
69
|
+
def initialize(attrs)
|
70
|
+
super({ timestamp: Time.now.to_i }.merge(atrs))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
## Installation
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
gem 'ma'
|
79
|
+
```
|
80
|
+
|
81
|
+
## Security
|
82
|
+
|
83
|
+
* gem releases are [signed]()
|
84
|
+
* commits are GPG [signed]()
|
85
|
+
|
86
|
+
## Development
|
87
|
+
|
88
|
+
### Specs
|
89
|
+
|
90
|
+
Run the specs:
|
91
|
+
|
92
|
+
```
|
93
|
+
rspec
|
94
|
+
```
|
95
|
+
|
96
|
+
Runs the specs on file change:
|
97
|
+
|
98
|
+
```
|
99
|
+
ls ./**/*.rb | entr -c rspec
|
100
|
+
```
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/kris.leech/ma.
|
105
|
+
|
106
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
107
|
+
|
108
|
+
## License
|
109
|
+
|
110
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
111
|
+
|
112
|
+
## Code of Conduct
|
113
|
+
|
114
|
+
Everyone interacting in the Ma project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/kris.leech/ma/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ma"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDQDCCAiigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBprcmlz
|
3
|
+
LmxlZWNoL0RDPWdtYWlsL0RDPWNvbTAeFw0xOTEwMTYxNDEzNDVaFw0yMDEwMTUx
|
4
|
+
NDEzNDVaMCUxIzAhBgN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cnUQ2CM/VKjuVaW7gCPZIIXB8jxZULh6N2kdEIWk
|
75
|
+
nN33+99oxboRj/sfe5UKg1nAk4fq2+ZmcKKBPNboHgNw+tjK7HGR2TPm/TyIy4Hb
|
76
|
+
Hlvd6fEXh3FwraxB3guk7i6n1b5GekBbrzMsOcARTgUJ0U8J4PtxbF4Y0Zlih97h
|
77
|
+
edZfrfyDU/5wuvsFpJrjRENKKGd+SqbPD6D4eUN+rwumw178tP3lbc+NdGqk2F5i
|
78
|
+
mFSyha+nApmLJi3tQmN0aEDpNLkWFvqVF/+hOf9v6nKYPJIrsoVRosdoe8GY05ow
|
79
|
+
f5mDAt50d/du4gpgsvVOaYGga+fcgbCCG4jsEXQek0tFclYfCcCmRZp8
|
80
|
+
=reHQ
|
81
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
data/lib/ma.rb
ADDED
data/lib/ma/event.rb
ADDED
data/lib/ma/publisher.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'wisper_next'
|
2
|
+
|
3
|
+
module Ma
|
4
|
+
module Publisher
|
5
|
+
module Overrides
|
6
|
+
def broadcast(event)
|
7
|
+
name = event.class.name
|
8
|
+
super(name, event.to_h)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.included(base)
|
13
|
+
base.include(WisperNext.publisher)
|
14
|
+
base.include(Overrides)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'wisper_next'
|
2
|
+
|
3
|
+
module Ma
|
4
|
+
class Subscriber < Module
|
5
|
+
|
6
|
+
def initialize(*args)
|
7
|
+
@options = WisperNext::CastToOptions.(args)
|
8
|
+
end
|
9
|
+
|
10
|
+
def included(base)
|
11
|
+
base.extend(ClassMethods)
|
12
|
+
base.include(WisperNext.subscriber(@options.slice(:async)))
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
module ClassMethods
|
17
|
+
def on(event_class, &block)
|
18
|
+
define_method event_class.name do |payload|
|
19
|
+
instance_exec(event_class.new(payload), &block)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/ma/version.rb
ADDED
data/ma.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "ma/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ma"
|
7
|
+
spec.version = Ma::VERSION
|
8
|
+
spec.authors = ["Kris Leech"]
|
9
|
+
spec.email = ["kris.leech@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Event Driven Ruby"
|
12
|
+
spec.description = "Event Driven Ruby"
|
13
|
+
spec.homepage = "https://gitlab.com/kris.leech/ma"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
+
spec.metadata["changelog_uri"] = "https://gitlab.com/kris.leech/ma/blob/master/CHANGELOG.md"
|
19
|
+
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'wisper_next'
|
29
|
+
|
30
|
+
signing_key = File.expand_path(ENV['HOME'].to_s + '/.ssh/gem-private_key.pem')
|
31
|
+
|
32
|
+
if File.exist?(signing_key)
|
33
|
+
spec.signing_key = signing_key
|
34
|
+
spec.cert_chain = ['keys/gem-public_cert.pem']
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ma
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kris Leech
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDQDCCAiigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBprcmlz
|
14
|
+
LmxlZWNoL0RDPWdtYWlsL0RDPWNvbTAeFw0xOTEwMTYxNDEzNDVaFw0yMDEwMTUx
|
15
|
+
NDEzNDVaMCUxIzAhBgNVBAMMGmtyaXMubGVlY2gvREM9Z21haWwvREM9Y29tMIIB
|
16
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gg/iZE6RFkl6GjisJJf9wQl
|
17
|
+
5Tog+mrGqtylNpe9QKeyQS1fKLNR3Cqmv6sT3f3GlU8hhG+802MXmlJo7VyENs+s
|
18
|
+
HdMy85fBnYwhS/szhTzBqduXw43RAAGqB0VaHAoHdufTZBkmFSXET5c0/jUqQrPL
|
19
|
+
Zxsm2i0NV8cVpvrZlQcsW4Kf97DG1ZFNncS0IfCDqnluh21qMSgVAuiKHGoVKCYG
|
20
|
+
Igey486VuuJ8j6axwW3ii8HoBOxjF8Ka/rJ/t4sB9Ql/p6RHR4RhxP5xIS9geCpI
|
21
|
+
dsPGnCSleTW1EnXGHLdOdJpVmJXueYJEQJ1Rh/rR+9PeqAT3RA0D/dxSGIVtrQID
|
22
|
+
AQABo3sweTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUyupX2gb3
|
23
|
+
+isBRwf4/fhgLnh02sYwHwYDVR0RBBgwFoEUa3Jpcy5sZWVjaEBnbWFpbC5jb20w
|
24
|
+
HwYDVR0SBBgwFoEUa3Jpcy5sZWVjaEBnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
|
25
|
+
ggEBAExirH+Py0Wm8+ZzNnx/oyFXSF7V9FClYhPUXwQ5FmvQG+gXRlonO9IR/HL+
|
26
|
+
wGJNFh4B19fpughgQeJKjKJsG2zk2XnSK2yQyyNGdr/9dHXp/TS5sGvX9jFYVeAr
|
27
|
+
0XCWXRBK+IfEqNnbFvPkwZEK62WLnrL50gMs3u2ILmLP5gkO3EoLyezJvIj33CLO
|
28
|
+
HX0Plp0VwiSp8+gEELX5wtdrnJ/UjmrY1lg7szukE+jgOJ++1e7Rzr+woBewIWvF
|
29
|
+
xn3z1ObkNQCnLZMRmzEcSa40T10/AuuuEv32emAgb50u9vz+s4y2lnE9i4mWW7+X
|
30
|
+
5vdRgX7VnzYPA+Lc39kD+AcGIrQ=
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: wisper_next
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
description: Event Driven Ruby
|
49
|
+
email:
|
50
|
+
- kris.leech@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- ".gitignore"
|
56
|
+
- ".gitlab-ci.yml"
|
57
|
+
- ".rspec"
|
58
|
+
- ".ruby-version"
|
59
|
+
- ".travis.yml"
|
60
|
+
- CHANGELOG.md
|
61
|
+
- CODE_OF_CONDUCT.md
|
62
|
+
- Gemfile
|
63
|
+
- LICENSE.txt
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- bin/console
|
67
|
+
- bin/setup
|
68
|
+
- keys/gem-public_cert.pem
|
69
|
+
- keys/kris.leech.gpg.public
|
70
|
+
- lib/ma.rb
|
71
|
+
- lib/ma/event.rb
|
72
|
+
- lib/ma/publisher.rb
|
73
|
+
- lib/ma/subscriber.rb
|
74
|
+
- lib/ma/version.rb
|
75
|
+
- ma.gemspec
|
76
|
+
homepage: https://gitlab.com/kris.leech/ma
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata:
|
80
|
+
homepage_uri: https://gitlab.com/kris.leech/ma
|
81
|
+
source_code_uri: https://gitlab.com/kris.leech/ma
|
82
|
+
changelog_uri: https://gitlab.com/kris.leech/ma/blob/master/CHANGELOG.md
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubygems_version: 3.0.6
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Event Driven Ruby
|
102
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|