anycable-rails-core 1.5.0.rc.1 → 1.5.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: 3b614e500208e2a3f4ea896da9228028302800348084305868ea0c22178f858b
4
- data.tar.gz: 83c91a4e4aa9dde124ed862addaf6e927a3638fd3187e7df781bfb8745c71319
3
+ metadata.gz: e23407a3fe0b10d54fdb4c0b368f23df917dc5f901b821312c9464c37099c23d
4
+ data.tar.gz: ce1ea7b919210c7ea6a2d0098a5bf90141ce3910d57f17f9cbb116b96d93753f
5
5
  SHA512:
6
- metadata.gz: 18066377abcddc253760bc1afe77f5701f20fc9c7de4f83ed9ba9f98d91c8c68efe01943b724d39eaf39e58280825fe858b195871386a21acb34a191cede0b8a
7
- data.tar.gz: ade05b2cd18c667d69626782031beb41885d3d9162c42042663baee100aaa930ff22a1f939bb3424ca7f7e2ec31225bf6ae9cdefc1b4892e692cd4c6a6d4dcc2
6
+ metadata.gz: 658fffc579a1ddea3001a6ed05f6b59dbe1f05f48ce27c70924cd0ae18b0d8c2bd4c3151b0ea82b52ea78f37e9217f2b80769683dadeba21b2f9f50b6588a566
7
+ data.tar.gz: c8982b7cae01bfdefa4c0bef71581b7de2b579a0471bf2ff32619c043e84710822026e9814682474e84c386880808d79a651db0d42ff68d0d7ae646630050522
data/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 1.5.0.rc.1
5
+ ## 1.5.0 (2024-04-01)
6
+
7
+ - Allow specifying the _whispering_ stream via `#stream_from(..., whisper: true)`. ([@palkan][])
8
+
9
+ You can use specify the stream to use for _whispering_ (client-initiated broadcasts) by adding `whisper: true` to the `#stream_from` (or `#stream_for`) method call.
10
+
11
+ NOTE: This feature is only supported when using AnyCable server and ignored otherwise.
6
12
 
7
13
  - Support passing objects to `ActionCable.server.broadcast`. ([@palkan][])
8
14
 
@@ -22,12 +22,20 @@ ActionCable::Channel::Base.prepend(Module.new do
22
22
  super unless anycabled?
23
23
  end
24
24
 
25
- def stream_from(broadcasting, _callback = nil, **)
25
+ def stream_from(broadcasting, _callback = nil, **opts)
26
+ whispering = opts.delete(:whisper)
26
27
  return super unless anycabled?
27
28
 
28
29
  broadcasting = String(broadcasting)
29
30
 
30
31
  connection.anycable_socket.subscribe identifier, broadcasting
32
+ if whispering
33
+ connection.anycable_socket.whisper identifier, broadcasting
34
+ end
35
+ end
36
+
37
+ def stream_for(model, callback = nil, **opts, &block)
38
+ stream_from(broadcasting_for(model), callback || block, **opts)
31
39
  end
32
40
 
33
41
  def stop_stream_from(broadcasting)
@@ -12,9 +12,10 @@ module AnyCable
12
12
  return @#{name} if instance_variable_defined?(:@#{name})
13
13
  return unless anycabled?
14
14
 
15
- val = __istate__["#{name}"]
15
+ raw_val = __istate__["#{name}"]
16
+ val = raw_val.present? ? AnyCable::Serializer.deserialize(JSON.parse(raw_val)) : nil
16
17
 
17
- @#{name} = val.present? ? AnyCable::Serializer.deserialize(JSON.parse(val)) : nil
18
+ @#{name} = val.try(:with_indifferent_access) || val
18
19
  end
19
20
 
20
21
  def #{name}=(val)
@@ -11,7 +11,7 @@ module AnyCable
11
11
  ]
12
12
 
13
13
  ActionCable::Channel::Base.prepend(Module.new do
14
- def stream_from(broadcasting, callback = nil, coder: nil)
14
+ def stream_from(broadcasting, callback = nil, coder: nil, **)
15
15
  if coder.present? && coder != ActiveSupport::JSON
16
16
  raise AnyCable::CompatibilityError, "Custom coders are not supported by AnyCable"
17
17
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.5.0.rc.1"
5
+ VERSION = "1.5.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.rc.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-13 00:00:00.000000000 Z
11
+ date: 2024-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.0.rc.1
19
+ version: 1.5.0
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: 1.5.0.rc.1
26
+ version: 1.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actioncable
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -129,9 +129,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '2.7'
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ">"
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: 1.3.1
134
+ version: '0'
135
135
  requirements: []
136
136
  rubygems_version: 3.4.20
137
137
  signing_key: