activestate 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +3 -0
- data/lib/activestate/channel.rb +62 -0
- data/lib/activestate/version.rb +3 -0
- data/lib/activestate.rb +2 -0
- data/lib/tasks/actionstore_tasks.rake +4 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9ddbb00899f699f64a7824c360592bb8cd9afc30f26244c406794f5c9420dada
|
4
|
+
data.tar.gz: 96b3f98f72e8b9a6d15b36acbd56e5e2035c3cd7e75ef6c62d047daf431f6275
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 59b49d1e2b154f2dfea209e8400e14ce20a54a12ce68899d98db086584d74394f585936c3f8c728ff3ed513c6dc159fbfbce952acfd656e458117ff37ccee0db
|
7
|
+
data.tar.gz: 0a44052a940dbea3fef5ed6403f5532729a724ef9bb90a2d5752e187812b795b851a974c4f2de480b3a118fe853b8898f62c3098a13bc91bae77e4f6a09b9926
|
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module ApplicationCable
|
2
|
+
class State
|
3
|
+
def initialize subject, channel, path = nil
|
4
|
+
@channel = channel
|
5
|
+
@subject = subject
|
6
|
+
@path = path
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
def transmit action, data
|
11
|
+
message = {path: @path, action: action}.compact
|
12
|
+
if @subject
|
13
|
+
@channel.broadcast_to @subject, message.merge(data: data)
|
14
|
+
else
|
15
|
+
@channel.transmit message.merge(data: data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def set value
|
20
|
+
transmit :set, value
|
21
|
+
end
|
22
|
+
|
23
|
+
def merge value
|
24
|
+
transmit :merge, value
|
25
|
+
end
|
26
|
+
|
27
|
+
def upsert value, key = 'id'
|
28
|
+
transmit :upsert, key: key, value: value
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete value
|
32
|
+
transmit :delete, value
|
33
|
+
end
|
34
|
+
|
35
|
+
def method_missing method, data
|
36
|
+
transmit method, data
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class ScopedChannel
|
41
|
+
def initialize channel, subject
|
42
|
+
@channel = channel
|
43
|
+
@subject = subject
|
44
|
+
end
|
45
|
+
|
46
|
+
def state(path)
|
47
|
+
State.new(@subject, @channel, path)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
class Channel < ActionCable::Channel::Base
|
52
|
+
public :transmit
|
53
|
+
|
54
|
+
def self.[](subject)
|
55
|
+
ScopedChannel.new(self, subject)
|
56
|
+
end
|
57
|
+
|
58
|
+
def state(path)
|
59
|
+
State.new(nil, self, path)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/activestate.rb
ADDED
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activestate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stefan Buhrmester
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rails
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 7.0.4
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 7.0.4
|
26
|
+
description: Push data into Svelte stores from Rails
|
27
|
+
email:
|
28
|
+
- buhrmi@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Rakefile
|
34
|
+
- lib/activestate.rb
|
35
|
+
- lib/activestate/channel.rb
|
36
|
+
- lib/activestate/version.rb
|
37
|
+
- lib/tasks/actionstore_tasks.rake
|
38
|
+
homepage: https://github.com/buhrmi/activestate
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata:
|
42
|
+
homepage_uri: https://github.com/buhrmi/activestate
|
43
|
+
source_code_uri: https://github.com/buhrmi/activestate
|
44
|
+
changelog_uri: https://github.com/buhrmi/activestate
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubygems_version: 3.6.8
|
60
|
+
specification_version: 4
|
61
|
+
summary: Push data into Svelte stores from Rails
|
62
|
+
test_files: []
|