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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 479391be7cf538ec1e33167e15508617bbd6312f607204185f0be6f12bba0372
4
- data.tar.gz: 1365a880d79a4e838a6101de9bd5ec7678f4f2be74bd3be9570f898d3949ccf0
3
+ metadata.gz: 7b045cea0f5c6f123854c0a40b8953e869b18d0f97b31f332f96fd9b5d8c9d31
4
+ data.tar.gz: 9ee0e7159ede72b756f29a25adbd1982363f27f26f803f1d3f4d9c8cfbae2a3a
5
5
  SHA512:
6
- metadata.gz: e7d596e1289162d46b33bb68355032e64c125ed80e82a2be7203ccb6dd5095bdf511a82f71be2346188e45d7232c654c84b0d0234fc260f3e15ea2c211a0627a
7
- data.tar.gz: 7a3dd738a162abd503389b5e46173f3d68bd3de72c672a1df5ea94eb7cc3e168d40a07f809841d50de5f70111265fd730a6db28c3a1e1800bd167956963d8bd5
6
+ metadata.gz: 236a3ddae5fcc7fb45f17bbfe8f0e48a8a9ac152cb83a4b53a4b9b5e4416a078ec7e4aaa65d5a31ac69a422574e63857787dac57f240f8c0397bfc42be25dfc4
7
+ data.tar.gz: 3857fd4ee3754ab803707ddeb86bc1cbaa7aead76f389202b43146ac11a76a71600a5e238a05dc1b80e6b67f7495374b20ed63ec45d653389b95126d22cc42b5
@@ -1,5 +1,3 @@
1
- include Loco::Emitter
2
-
3
1
  def loco_permissions
4
2
  # specify an array of method names which you use to determine
5
3
  # if given resource is signed-in
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Loco
4
4
  class NotificationCenter
5
- include Emitter
6
-
7
5
  def received_message(permissions, data)
8
6
  # handle messages here
9
7
  end
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
- Broadcaster.(
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
- Sender.(recipient_s, data)
11
+ Loco.emit_to(recipient_s, data)
16
12
  end
17
13
 
18
14
  def add_hub(name, members = [])
19
- Hub.set(name, members)
15
+ Loco.add_hub(name, members)
20
16
  end
21
17
 
22
18
  def get_hub(name)
23
- Hub.get(name)
19
+ Loco.get_hub(name)
24
20
  end
25
21
 
26
22
  def del_hub(name)
27
- hub = Hub.get(name)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Loco
4
- VERSION = '6.0.0'
4
+ VERSION = '6.1.0'
5
5
  end
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.0.0
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-02-03 00:00:00.000000000 Z
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.5.2
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.5.2
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.3
315
+ rubygems_version: 3.3.7
316
316
  signing_key:
317
317
  specification_version: 4
318
318
  summary: Framework on top of Rails.