view_component_reflex 3.0.4 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/view_component_reflex/component.rb +1 -1
- data/lib/view_component_reflex.rb +1 -0
- data/lib/view_component_reflex/state_adapter/base.rb +18 -0
- data/lib/view_component_reflex/state_adapter/memory.rb +1 -12
- data/lib/view_component_reflex/state_adapter/redis.rb +4 -3
- data/lib/view_component_reflex/state_adapter/session.rb +1 -1
- data/lib/view_component_reflex/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c063a5b69263cf48e6a92937e65a73cd1a2c5e00577734f62b7cbf6186604d3
|
4
|
+
data.tar.gz: 26ec1a060c0283a906df2bcda4cd11110bb31ebe69e9d5c741cf568d6dabd7de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f55e4e85f42a9c9b0044710f8f2c295e0c13350bfc26f1c940626b581e68a851feb1c7cf4c54124a7e96ac9ade6565b1e3361f789e0efbc16644c78bc906b2
|
7
|
+
data.tar.gz: aa24fa075eae92847e04931a1278b20358472fc9fdb00079bb1f0b774d84f5a3a047f90d61e42295a578999a7c69ec12e152847d77ecf6a4236554d4b4c38605
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "stimulus_reflex"
|
2
2
|
require 'view_component_reflex/reflex_factory'
|
3
|
+
require "view_component_reflex/state_adapter/base"
|
3
4
|
require "view_component_reflex/state_adapter/session"
|
4
5
|
require "view_component_reflex/state_adapter/memory"
|
5
6
|
require "view_component_reflex/state_adapter/redis"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
VIEW_COMPONENT_REFLEX_MEMORY_STATE = {}
|
2
2
|
module ViewComponentReflex
|
3
3
|
module StateAdapter
|
4
|
-
class Memory
|
4
|
+
class Memory < Base
|
5
5
|
def self.state(request, key)
|
6
6
|
id = extract_id(request)
|
7
7
|
|
@@ -28,17 +28,6 @@ module ViewComponentReflex
|
|
28
28
|
def self.wrap_write_async
|
29
29
|
yield
|
30
30
|
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def self.extract_id(request)
|
35
|
-
session = request&.session
|
36
|
-
if session.respond_to? :id
|
37
|
-
session.id.to_s
|
38
|
-
else
|
39
|
-
nil
|
40
|
-
end
|
41
|
-
end
|
42
31
|
end
|
43
32
|
end
|
44
33
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
module ViewComponentReflex
|
12
12
|
module StateAdapter
|
13
|
-
class Redis
|
13
|
+
class Redis < Base
|
14
14
|
attr_reader :client, :ttl
|
15
15
|
|
16
16
|
def initialize(redis_opts:, ttl: 3600)
|
@@ -67,8 +67,9 @@ module ViewComponentReflex
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def get_key(request, key)
|
70
|
-
|
70
|
+
id = Redis.extract_id(request)
|
71
|
+
"#{id}_#{key}_session_reflex_redis"
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
74
|
-
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua LeBlanc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/view_component_reflex/engine.rb
|
88
88
|
- lib/view_component_reflex/reflex.rb
|
89
89
|
- lib/view_component_reflex/reflex_factory.rb
|
90
|
+
- lib/view_component_reflex/state_adapter/base.rb
|
90
91
|
- lib/view_component_reflex/state_adapter/memory.rb
|
91
92
|
- lib/view_component_reflex/state_adapter/redis.rb
|
92
93
|
- lib/view_component_reflex/state_adapter/session.rb
|