turbo_reflex 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/turbo_reflex/provisional_state.rb +5 -0
- data/lib/turbo_reflex/state.rb +12 -1
- data/lib/turbo_reflex/state_manager.rb +21 -11
- data/lib/turbo_reflex/version.rb +1 -1
- data/package.json +1 -1
- data/tags +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a743b2b5affa9a74da2b18ada148e17e1cb24538027716742c4c037d23a646
|
4
|
+
data.tar.gz: cd14a193d0e77cad794ee96bcfedded9aac76a491327157ddec8f79983c0b065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e36653da2dfa283fb45f78a4f124f043fdf3f68d20514d6c5902a300d4eeab136c4ae69ccf591e6cf7e51fc2de95c29d2c86b078876798e1b9e83d87f29c62b
|
7
|
+
data.tar.gz: f82d726508e0dc8494d6ee7fa101478bd57095348c77d65318b6e8c387a8d870d380f2e88af3b2e691d709a81ae9fa045b4a7c04aa4187904ae4275e992006da
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
</h1>
|
9
9
|
<p align="center">
|
10
10
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/">
|
11
|
-
<img alt="Lines of Code" src="https://img.shields.io/badge/loc-
|
11
|
+
<img alt="Lines of Code" src="https://img.shields.io/badge/loc-1209-47d299.svg" />
|
12
12
|
</a>
|
13
13
|
<a href="https://codeclimate.com/github/hopsoft/turbo_reflex/maintainability">
|
14
14
|
<img src="https://api.codeclimate.com/v1/badges/fe1162a742fe83a4fdfd/maintainability" />
|
data/lib/turbo_reflex/state.rb
CHANGED
@@ -34,8 +34,8 @@ class TurboReflex::State
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def initialize(ordinal_payload = nil)
|
37
|
-
@internal_keys = []
|
38
37
|
@internal_data = {}.with_indifferent_access
|
38
|
+
@internal_keys = []
|
39
39
|
|
40
40
|
deserialize(ordinal_payload).each do |(key, value)|
|
41
41
|
write key, value
|
@@ -64,6 +64,12 @@ class TurboReflex::State
|
|
64
64
|
value
|
65
65
|
end
|
66
66
|
|
67
|
+
def delete(*keys)
|
68
|
+
key = key_for(*keys)
|
69
|
+
internal_keys.delete key
|
70
|
+
internal_data.delete key
|
71
|
+
end
|
72
|
+
|
67
73
|
def payload
|
68
74
|
serialize_base64 internal_data
|
69
75
|
end
|
@@ -72,6 +78,11 @@ class TurboReflex::State
|
|
72
78
|
serialize internal_list
|
73
79
|
end
|
74
80
|
|
81
|
+
def clear
|
82
|
+
internal_keys.clear
|
83
|
+
internal_data.clear
|
84
|
+
end
|
85
|
+
|
75
86
|
def shrink!
|
76
87
|
@internal_data = shrink(internal_data).with_indifferent_access
|
77
88
|
@internal_keys = internal_keys & internal_data.keys
|
@@ -99,7 +99,7 @@ class TurboReflex::StateManager
|
|
99
99
|
@state ||= TurboReflex::State.new
|
100
100
|
end
|
101
101
|
|
102
|
-
delegate :cache_key,
|
102
|
+
delegate :cache_key, to: :state
|
103
103
|
|
104
104
|
def [](*keys, default: nil)
|
105
105
|
state.read(*keys, default: default)
|
@@ -107,7 +107,7 @@ class TurboReflex::StateManager
|
|
107
107
|
|
108
108
|
def []=(*keys, value)
|
109
109
|
state_will_change! if value != self[*keys]
|
110
|
-
state.write(*keys, value)
|
110
|
+
value.nil? ? state.delete(*keys) : state.write(*keys, value)
|
111
111
|
end
|
112
112
|
|
113
113
|
def provisional_state
|
@@ -116,12 +116,27 @@ class TurboReflex::StateManager
|
|
116
116
|
|
117
117
|
alias_method :now, :provisional_state
|
118
118
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
119
|
+
def clear
|
120
|
+
provisional_state.clear
|
121
|
+
state.clear
|
122
|
+
end
|
123
|
+
|
124
|
+
def payload
|
125
|
+
provisional_state.clear
|
126
|
+
state.shrink!
|
127
|
+
state.payload
|
128
|
+
end
|
129
|
+
|
130
|
+
def ordinal_payload
|
131
|
+
provisional_state.clear
|
122
132
|
state.shrink!
|
123
133
|
state.prune! max_bytesize: TurboReflex::StateManager.cookie_max_bytesize
|
124
|
-
|
134
|
+
state.ordinal_payload
|
135
|
+
end
|
136
|
+
|
137
|
+
def write_cookie
|
138
|
+
return unless changed?
|
139
|
+
cookies.signed["turbo_reflex.state"] = {value: ordinal_payload, path: "/", expires: 1.day.from_now}
|
125
140
|
changes_applied
|
126
141
|
rescue => error
|
127
142
|
Rails.logger.error "Failed to write the TurboReflex::State cookie! #{error.message}"
|
@@ -145,9 +160,4 @@ class TurboReflex::StateManager
|
|
145
160
|
def cookie
|
146
161
|
cookies.signed["turbo_reflex.state"]
|
147
162
|
end
|
148
|
-
|
149
|
-
def clear_provisional_state!
|
150
|
-
provisional_state.keys.each { |key| state.write key, nil }
|
151
|
-
@provisional_state = nil
|
152
|
-
end
|
153
163
|
end
|
data/lib/turbo_reflex/version.rb
CHANGED
data/package.json
CHANGED
data/tags
CHANGED
@@ -216620,7 +216620,7 @@ VDash node_modules/parse-srcset/tests/he.js /^ var decodeMap = {'Aacute':'\\xC1'
|
|
216620
216620
|
VDash node_modules/simple-html-tokenizer/dist/es6/index.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳",/;" p variable:namedCharRefs
|
216621
216621
|
VDash node_modules/simple-html-tokenizer/dist/simple-html-tokenizer.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾/;" p variable:anonymousFunction3825d8d70300.namedCharRefs
|
216622
216622
|
VDash node_modules/simple-html-tokenizer/dist/types/generated/html5-named-char-refs.d.ts /^ VDash: string;$/;" C
|
216623
|
-
VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.
|
216623
|
+
VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.23"$/;" C module:TurboReflex
|
216624
216624
|
VERSION node_modules/@angular/compiler/esm2015/src/output/source_map.js /^const VERSION = 3;$/;" C
|
216625
216625
|
VERSION node_modules/@angular/compiler/esm2015/src/version.js /^export const VERSION = new Version('8.2.14');$/;" C
|
216626
216626
|
VERSION node_modules/@angular/compiler/esm5/src/output/source_map.js /^var VERSION = 3;$/;" v
|
@@ -292615,6 +292615,9 @@ cleanupModifierEffects node_modules/@popperjs/core/dist/umd/popper.js /^ fu
|
|
292615
292615
|
cleanupModifierEffects node_modules/@popperjs/core/lib/createPopper.js /^ function cleanupModifierEffects() {$/;" f function:popperGenerator.createPopper
|
292616
292616
|
cleanupModifierEffects node_modules/flowbite/dist/flowbite.js /^ function cleanupModifierEffects() {$/;" f function:popperGenerator.createPopper
|
292617
292617
|
cleanupSubscription node_modules/prettier-standard/src/vendor/node_modules/core-js-pure/modules/esnext.observable.js /^var cleanupSubscription = function (subscriptionState) {$/;" f
|
292618
|
+
clear lib/turbo_reflex/provisional_state.rb /^ def clear$/;" f class:ProvisionalState
|
292619
|
+
clear lib/turbo_reflex/state.rb /^ def clear$/;" f class:State
|
292620
|
+
clear lib/turbo_reflex/state_manager.rb /^ def clear$/;" f class:StateManager
|
292618
292621
|
clear node_modules/@eslint/eslintrc/lib/config-array/config-array.js /^ clear: { configurable: true, value: void 0 },$/;" p variable:anonymousObject030c97c70305
|
292619
292622
|
clear node_modules/@glimmer/interfaces/dist/types/lib/list.d.ts /^ clear(): void;$/;" m interface:LinkedList
|
292620
292623
|
clear node_modules/@glimmer/util/dist/amd/es5/glimmer-util.js /^ LinkedList.prototype.clear = function clear() {$/;" m class:LinkedList
|
@@ -292886,7 +292889,6 @@ clearTimeout node_modules/prettier-standard/src/vendor/node_modules/globals/glob
|
|
292886
292889
|
clearTimeout node_modules/prettier-standard/src/vendor/node_modules/globals/globals.json /^ "clearTimeout": false,$/;" b object:shared-node-browser
|
292887
292890
|
clearTimeout node_modules/prettier-standard/src/vendor/node_modules/globals/globals.json /^ "clearTimeout": false,$/;" b object:worker
|
292888
292891
|
clearValue node_modules/prettier-standard/src/vendor/node_modules/@babel/traverse/lib/scope/binding.js /^ clearValue() {$/;" m class:Binding
|
292889
|
-
clear_provisional_state! lib/turbo_reflex/state_manager.rb /^ def clear_provisional_state!$/;" f class:StateManager
|
292890
292892
|
clear_write_only node_modules/uglify-js/lib/compress.js /^ function clear_write_only(assign) {$/;" f function:collapse
|
292891
292893
|
clear_write_only node_modules/uglify-js/lib/compress.js /^ function clear_write_only(node) {$/;" f function:anonymousFunction8b3d0ad81e500.trim_destructured
|
292892
292894
|
cleartext node_modules/@types/node/tls.d.ts /^ cleartext: TLSSocket;$/;" p interface:SecurePair
|
@@ -309814,6 +309816,7 @@ delegateType node_modules/@angular/compiler/src/render3/r3_factory.d.ts /^ de
|
|
309814
309816
|
delegateType node_modules/@angular/compiler/src/render3/r3_factory.d.ts /^ delegateType: R3FactoryDelegateType.Factory;$/;" p interface:R3DelegatedFactoryMetadata
|
309815
309817
|
delegateYield node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js /^ delegateYield: function delegateYield(iterable, resultName, nextLoc) {$/;" f
|
309816
309818
|
delegateYield node_modules/@babel/runtime/helpers/regeneratorRuntime.js /^ delegateYield: function delegateYield(iterable, resultName, nextLoc) {$/;" f
|
309819
|
+
delete lib/turbo_reflex/state.rb /^ def delete(*keys)$/;" f class:State
|
309817
309820
|
delete node_modules/@eslint/eslintrc/lib/config-array/config-array.js /^ delete: { configurable: true, value: void 0 },$/;" p variable:anonymousObject030c97c70305
|
309818
309821
|
delete node_modules/@glimmer/util/dist/amd/es5/glimmer-util.js /^ DictSet.prototype.delete = function _delete(obj) {$/;" m class:DictSet
|
309819
309822
|
delete node_modules/@glimmer/util/dist/commonjs/es5/lib/collections.js /^ DictSet.prototype.delete = function _delete(obj) {$/;" m class:DictSet
|
@@ -401624,6 +401627,7 @@ ordinalFormatters.forEach node_modules/date-fns/locale/ru/build_format_locale/in
|
|
401624
401627
|
ordinalGenders node_modules/date-fns/locale/el/build_format_locale/index.js /^ var ordinalGenders = {$/;" v function:buildFormatLocale
|
401625
401628
|
ordinalKeys.forEach node_modules/date-fns/locale/el/build_format_locale/index.js /^ ordinalKeys.forEach(function (formatterToken) {$/;" p
|
401626
401629
|
ordinal_payload lib/turbo_reflex/state.rb /^ def ordinal_payload$/;" f class:State
|
401630
|
+
ordinal_payload lib/turbo_reflex/state_manager.rb /^ def ordinal_payload$/;" f class:StateManager
|
401627
401631
|
ordinaryDefineOwnMetadata node_modules/prettier-standard/src/vendor/node_modules/core-js-pure/internals/reflect-metadata.js /^var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) {$/;" f
|
401628
401632
|
ordinaryDefineOwnMetadata node_modules/prettier-standard/src/vendor/node_modules/core-js-pure/modules/esnext.reflect.define-metadata.js /^var ordinaryDefineOwnMetadata = ReflectMetadataModule.set;$/;" v
|
401629
401633
|
ordinaryDefineOwnMetadata node_modules/prettier-standard/src/vendor/node_modules/core-js-pure/modules/esnext.reflect.metadata.js /^var ordinaryDefineOwnMetadata = ReflectMetadataModule.set;$/;" v
|
@@ -408758,6 +408762,7 @@ paused node_modules/neo-async/async.js /^ paused: false,$/;" p variable:ano
|
|
408758
408762
|
paused node_modules/neo-async/async.min.js /^h<n.concurrency&&n._tasks.length;){for(var a=n._tasks.splice(n.payload||n._tasks.length),b=-1,d=/;" p variable:ca.M.na.n
|
408759
408763
|
payload app/javascript/index.js /^ payload = {$/;" v function:invokeReflex
|
408760
408764
|
payload lib/turbo_reflex/state.rb /^ def payload$/;" f class:State
|
408765
|
+
payload lib/turbo_reflex/state_manager.rb /^ def payload$/;" f class:StateManager
|
408761
408766
|
payload node_modules/@types/node/module.d.ts /^ readonly payload: SourceMapPayload;$/;" p class:Module.SourceMap
|
408762
408767
|
payload node_modules/@types/node/ts4.8/module.d.ts /^ readonly payload: SourceMapPayload;$/;" p class:Module.SourceMap
|
408763
408768
|
payload node_modules/neo-async/async.js /^ payload: payload,$/;" p variable:anonymousFunction3eb83f570400.baseQueue.q
|
@@ -468457,7 +468462,7 @@ version node_modules/yaml/dist/index.js /^ version: '1.2'$/;" p variable:defaul
|
|
468457
468462
|
version node_modules/yaml/dist/test-events.js /^ version: '1.2'$/;" p variable:testEvents.anonymousObjecta2b129440205
|
468458
468463
|
version node_modules/yaml/package.json /^ "version": "1.8.3",$/;" s
|
468459
468464
|
version node_modules/yocto-queue/package.json /^ "version": "0.1.0",$/;" s
|
468460
|
-
version package.json /^ "version": "0.0.
|
468465
|
+
version package.json /^ "version": "0.0.22",$/;" s
|
468461
468466
|
versionIncluded node_modules/prettier-standard/src/vendor/node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
|
468462
468467
|
versionIncluded node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
|
468463
468468
|
versionInfo node_modules/graphql/version.d.ts /^export const versionInfo: {$/;" C
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Hopkins (hopsoft)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|