hecks-events 0.1.9

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/hecks-events.rb +27 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3e6ad8d8a4051b1ccd8338a72c52ff029b6cef72
4
+ data.tar.gz: f5258508efef151538c246c8f72f300fdb03b7c7
5
+ SHA512:
6
+ metadata.gz: 5a8d26e7fc6ea1f01181b063dbfceabf1f540afd1df572cc591b288c727aafa6deb17484a4edc2391d34656305219fd66e4f8c4e303a7761a6aada77c99c0b20
7
+ data.tar.gz: b5997cb88433ab4a9baedf6255824747c7a88bd9bdb3e83ac12bb0670e77b48b5c7017011f5e10fdab457ee8c57186e2d5863040ed7f40a1df22347c3624308c
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ module Hecks
3
+ module Adapters
4
+ class Events
5
+ def initialize(listeners: [])
6
+ @listeners = listeners
7
+ end
8
+
9
+ def send(module_name:, command:)
10
+ @command = command
11
+ @module_name = module_name
12
+ listeners.each do |listener|
13
+ next unless listener.respond_to?(event_name)
14
+ listener.public_send(event_name, command)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :listeners, :command, :module_name
21
+
22
+ def event_name
23
+ "#{module_name}_#{command.name}".to_sym
24
+ end
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hecks-events
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.9
5
+ platform: ruby
6
+ authors:
7
+ - Chris Young
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Hecks Events
14
+ email: chris@example.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/hecks-events.rb
20
+ homepage: https://github.com/chrisyoung/hecks
21
+ licenses:
22
+ - MIT
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.6.10
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A basic eventing interface for your hecks application
44
+ test_files: []