loco-rails 6.0.0 → 6.2.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: f19b00ff36ec7132b45de85129912e7d2172ae9149e3b21120f76ce492336b71
4
+ data.tar.gz: 2e0392a0b88a6718909bd6b4e080b5879ac7d0eb8a0800651490cae374dfd58b
5
5
  SHA512:
6
- metadata.gz: e7d596e1289162d46b33bb68355032e64c125ed80e82a2be7203ccb6dd5095bdf511a82f71be2346188e45d7232c654c84b0d0234fc260f3e15ea2c211a0627a
7
- data.tar.gz: 7a3dd738a162abd503389b5e46173f3d68bd3de72c672a1df5ea94eb7cc3e168d40a07f809841d50de5f70111265fd730a6db28c3a1e1800bd167956963d8bd5
6
+ metadata.gz: 679524b086a06791d153905990346b7db8ba2500ed7d237ddbc76d5ec3d5ca738012f0ab51028b623b4d3de6bce6cda4c3e992f7b32e8ccee0cd5e26ceb7bcfe
7
+ data.tar.gz: edd79606b2751690384a226cfa32e64f938e5dd8a2af80aba260f75ba1872567c0b24dd18421bc0575b6e908efb06ceb7622ed6129c8956cd739dbf4a17ff456
@@ -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/config.rb CHANGED
@@ -13,22 +13,9 @@ module Loco
13
13
  self.silence_logger = config.silence_logger if config.silence_logger
14
14
  self.notifications_size = config.notifications_size if config.notifications_size
15
15
  self.app_name = config.app_name if config.app_name
16
- configure_redis config.redis_instance
16
+ self.redis_instance = config.redis_instance
17
17
  ensure
18
18
  true
19
19
  end
20
-
21
- def self.configure_redis(redis_instance)
22
- if redis_instance
23
- self.redis_instance = redis_instance
24
- return
25
- end
26
- return unless defined? Redis
27
-
28
- Redis.current.get 'random_redis_key'
29
- self.redis_instance = Redis.current
30
- rescue Redis::CannotConnectError
31
- self.redis_instance = nil
32
- end
33
20
  end
34
21
  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
@@ -9,7 +9,7 @@ module Loco
9
9
  o.class.name.downcase.to_sym
10
10
  end
11
11
  if opts[:except] == :uuid
12
- h.reject { |k, _| k == :string }
12
+ h.except(:string)
13
13
  else
14
14
  h
15
15
  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.2.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.2.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: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: loco-rails-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.2.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0
26
+ version: 0.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.1.16
47
+ version: 3.1.18
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.1.16
54
+ version: 3.1.18
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: capybara
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.36.0
61
+ version: 3.38.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.36.0
68
+ version: 3.38.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: database_cleaner
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,126 +100,126 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 3.7.1
103
+ version: 3.8.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 3.7.1
110
+ version: 3.8.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: mysql2
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.5.3
117
+ version: 0.5.5
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.5.3
124
+ version: 0.5.5
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: puma
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 5.5.2
131
+ version: 6.1.1
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: 6.1.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: redis
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 4.5.1
145
+ version: 5.0.6
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 4.5.1
152
+ version: 5.0.6
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rspec-expectations
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 3.10.2
159
+ version: 3.12.2
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 3.10.2
166
+ version: 3.12.2
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec-mocks
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 3.10.2
173
+ version: 3.12.3
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 3.10.2
180
+ version: 3.12.3
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rubocop
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: '1.48'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: '1.48'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rubocop-rails
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: 2.18.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: 2.18.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: selenium-webdriver
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 4.1.0
215
+ version: 4.8.1
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 4.1.0
222
+ version: 4.8.1
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: sprockets-rails
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -305,14 +305,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
305
  requirements:
306
306
  - - ">="
307
307
  - !ruby/object:Gem::Version
308
- version: 2.7.0
308
+ version: 3.0.0
309
309
  required_rubygems_version: !ruby/object:Gem::Requirement
310
310
  requirements:
311
311
  - - ">="
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0'
314
314
  requirements: []
315
- rubygems_version: 3.3.3
315
+ rubygems_version: 3.4.6
316
316
  signing_key:
317
317
  specification_version: 4
318
318
  summary: Framework on top of Rails.