hanami-controller 1.3.0.beta1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/hanami-controller.gemspec +1 -1
- data/lib/hanami/action/flash.rb +9 -7
- data/lib/hanami/controller/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd844a68050b975c377d225641cb0a73934bc21fb735ebff206bcdb72742edd9
|
4
|
+
data.tar.gz: d4943a7b7bef58e1d2c3dc824ff77f9654bb364d7f1c71a9cd6ab2e97b6a34c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 222964d792abfdcb03991814975ad55bbc08b10bc5a98ac7b1fe338b35b27643abd98657f447e110b5fe421676611f4941fc8a19604da06a09cd089ae5be0022
|
7
|
+
data.tar.gz: 0ffda8f6e455f25a87687f844a044faad15304f01a892b2d0362af5ea4789f42192904a86d7b3f10be7caf6a438fa8b143b905c43ed5559c3f12e526cff586f5
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Hanami::Controller
|
2
2
|
Complete, fast and testable actions for Rack
|
3
3
|
|
4
|
+
## v1.3.0 - 2018-10-24
|
5
|
+
### Added
|
6
|
+
- [Gustavo Caso] Swappable JSON backed for `Hanami::Action::Flash` based on `Hanami::Utils::Json`
|
7
|
+
|
4
8
|
## v1.3.0.beta1 - 2018-08-08
|
5
9
|
### Added
|
6
10
|
- [Luca Guidi] Official support for JRuby 9.2.0.0
|
data/README.md
CHANGED
@@ -587,7 +587,7 @@ action = RemoveCookies.new
|
|
587
587
|
action.call({}) # => [200, {'Set-Cookie' => "foo=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000"}, '...']
|
588
588
|
```
|
589
589
|
|
590
|
-
Default values can be set in configuration, but
|
590
|
+
Default values can be set in configuration, but overridden case by case.
|
591
591
|
|
592
592
|
```ruby
|
593
593
|
require 'hanami/controller'
|
data/hanami-controller.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.required_ruby_version = '>= 2.3.0'
|
21
21
|
|
22
22
|
spec.add_dependency 'rack', '~> 2.0'
|
23
|
-
spec.add_dependency 'hanami-utils', '~> 1.3
|
23
|
+
spec.add_dependency 'hanami-utils', '~> 1.3'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
26
|
spec.add_development_dependency 'rack-test', '~> 1.0'
|
data/lib/hanami/action/flash.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hanami/utils/json'
|
2
|
+
|
1
3
|
module Hanami
|
2
4
|
module Action
|
3
5
|
# Container useful to transport data with the HTTP session
|
@@ -178,7 +180,7 @@ module Hanami
|
|
178
180
|
# @since 1.3.0
|
179
181
|
# @api private
|
180
182
|
def keep_data
|
181
|
-
new_kept_data = kept <<
|
183
|
+
new_kept_data = kept << Hanami::Utils::Json.generate({ count: 0, data: _data })
|
182
184
|
|
183
185
|
update_kept(new_kept_data)
|
184
186
|
end
|
@@ -191,7 +193,7 @@ module Hanami
|
|
191
193
|
# @api private
|
192
194
|
def expire_kept
|
193
195
|
new_kept_data = kept.reject do |kept_data|
|
194
|
-
parsed =
|
196
|
+
parsed = Hanami::Utils::Json.parse(kept_data)
|
195
197
|
parsed['count'] >= 2 if is_hash?(parsed) && parsed['count'].is_a?(Integer)
|
196
198
|
end
|
197
199
|
|
@@ -206,9 +208,9 @@ module Hanami
|
|
206
208
|
# @api private
|
207
209
|
def update_kept_request_count
|
208
210
|
new_kept_data = kept.map do |kept_data|
|
209
|
-
parsed =
|
211
|
+
parsed = Hanami::Utils::Json.parse(kept_data)
|
210
212
|
parsed['count'] += 1 if is_hash?(parsed) && parsed['count'].is_a?(Integer)
|
211
|
-
|
213
|
+
Hanami::Utils::Json.generate(parsed)
|
212
214
|
end
|
213
215
|
|
214
216
|
update_kept(new_kept_data)
|
@@ -225,11 +227,11 @@ module Hanami
|
|
225
227
|
string_key = key.to_s
|
226
228
|
|
227
229
|
data = kept.find do |kept_data|
|
228
|
-
parsed =
|
230
|
+
parsed = Hanami::Utils::Json.parse(kept_data)
|
229
231
|
parsed['data'].fetch(string_key, nil) if is_hash?(parsed['data'])
|
230
232
|
end
|
231
233
|
|
232
|
-
|
234
|
+
Hanami::Utils::Json.parse(data)['data'][string_key] if data
|
233
235
|
end
|
234
236
|
|
235
237
|
# Set the given new_kept_data to KEPT_KEY
|
@@ -250,7 +252,7 @@ module Hanami
|
|
250
252
|
# @since 1.3.0
|
251
253
|
# @api private
|
252
254
|
def kept_data
|
253
|
-
kept.each_with_object({}) { |kept_data, result| result.merge!(
|
255
|
+
kept.each_with_object({}) { |kept_data, result| result.merge!(Hanami::Utils::Json.parse(kept_data)['data']) }
|
254
256
|
end
|
255
257
|
|
256
258
|
# Check if data is a hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3
|
33
|
+
version: '1.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3
|
40
|
+
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,9 +153,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: 2.3.0
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - "
|
156
|
+
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
158
|
+
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
161
|
rubygems_version: 2.7.7
|