loco-rails 6.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/loco/file_injector/templates/application_controller.rb +0 -2
- data/lib/generators/loco/notification_center/templates/services/loco/notification_center.rb +0 -2
- data/lib/loco/emitter.rb +6 -13
- data/lib/loco/version.rb +1 -1
- data/lib/loco-rails.rb +28 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b045cea0f5c6f123854c0a40b8953e869b18d0f97b31f332f96fd9b5d8c9d31
|
4
|
+
data.tar.gz: 9ee0e7159ede72b756f29a25adbd1982363f27f26f803f1d3f4d9c8cfbae2a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236a3ddae5fcc7fb45f17bbfe8f0e48a8a9ac152cb83a4b53a4b9b5e4416a078ec7e4aaa65d5a31ac69a422574e63857787dac57f240f8c0397bfc42be25dfc4
|
7
|
+
data.tar.gz: 3857fd4ee3754ab803707ddeb86bc1cbaa7aead76f389202b43146ac11a76a71600a5e238a05dc1b80e6b67f7495374b20ed63ec45d653389b95126d22cc42b5
|
data/lib/loco/emitter.rb
CHANGED
@@ -1,33 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# TODO: remove in v7
|
3
4
|
module Loco
|
4
5
|
module Emitter
|
5
6
|
def emit(obj, event = nil, opts = {})
|
6
|
-
|
7
|
-
obj,
|
8
|
-
event,
|
9
|
-
payload: opts[:payload] || opts[:data],
|
10
|
-
recipients: opts[opts[:for] ? :for : :to]
|
11
|
-
)
|
7
|
+
Loco.emit(obj, event, opts)
|
12
8
|
end
|
13
9
|
|
14
10
|
def emit_to(recipient_s, data)
|
15
|
-
|
11
|
+
Loco.emit_to(recipient_s, data)
|
16
12
|
end
|
17
13
|
|
18
14
|
def add_hub(name, members = [])
|
19
|
-
|
15
|
+
Loco.add_hub(name, members)
|
20
16
|
end
|
21
17
|
|
22
18
|
def get_hub(name)
|
23
|
-
|
19
|
+
Loco.get_hub(name)
|
24
20
|
end
|
25
21
|
|
26
22
|
def del_hub(name)
|
27
|
-
|
28
|
-
return false if hub.nil?
|
29
|
-
|
30
|
-
hub.destroy
|
23
|
+
Loco.del_hub(name)
|
31
24
|
end
|
32
25
|
end
|
33
26
|
end
|
data/lib/loco/version.rb
CHANGED
data/lib/loco-rails.rb
CHANGED
@@ -25,4 +25,32 @@ module Loco
|
|
25
25
|
Config.configure config
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
def emit(obj, event = nil, opts = {})
|
30
|
+
Broadcaster.(
|
31
|
+
obj,
|
32
|
+
event,
|
33
|
+
payload: opts[:payload] || opts[:data],
|
34
|
+
recipients: opts[opts[:for] ? :for : :to]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def emit_to(recipient_s, data)
|
39
|
+
Sender.(recipient_s, data)
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_hub(name, members = [])
|
43
|
+
Hub.set(name, members)
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_hub(name)
|
47
|
+
Hub.get(name)
|
48
|
+
end
|
49
|
+
|
50
|
+
def del_hub(name)
|
51
|
+
hub = Hub.get(name)
|
52
|
+
return false if hub.nil?
|
53
|
+
|
54
|
+
hub.destroy
|
55
|
+
end
|
28
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loco-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zbigniew Humeniuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: loco-rails-core
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 5.
|
131
|
+
version: 5.6.2
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 5.
|
138
|
+
version: 5.6.2
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: redis
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
312
|
- !ruby/object:Gem::Version
|
313
313
|
version: '0'
|
314
314
|
requirements: []
|
315
|
-
rubygems_version: 3.3.
|
315
|
+
rubygems_version: 3.3.7
|
316
316
|
signing_key:
|
317
317
|
specification_version: 4
|
318
318
|
summary: Framework on top of Rails.
|