flame-flash 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flame/flash.rb +17 -0
- data/lib/flame/flash_array.rb +5 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34ea27d4523bf6286024a2be3100e5266f28487a
|
4
|
+
data.tar.gz: 8eb40fd2360612f052f68b9273556865288b313b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06ffbc5df6906671adb359ac6ff758929c47dc6eb1b0140aa8b765f1ba3d64a88c20763f71753e4f83a6bf3d425a6068665023681deec4f986760292ee0e4210
|
7
|
+
data.tar.gz: 7d6711ee480a307e99196a687013e72190deed10af7b5cf1cf509f1243825067c88769c76846899db94053db40bbfaa8121abb525ace818fb446f58f2c8cfe99
|
data/lib/flame/flash.rb
CHANGED
@@ -3,13 +3,30 @@ require_relative 'flash_array'
|
|
3
3
|
module Flame
|
4
4
|
# Module for Flame::Flash extension with helper methods and base class
|
5
5
|
module Flash
|
6
|
+
## After hook
|
6
7
|
def execute(method)
|
7
8
|
super
|
8
9
|
session[:flash] = flash.next
|
9
10
|
end
|
10
11
|
|
12
|
+
## Upgrade redirect method
|
13
|
+
## @example Redirect to show method of Articles controller with error
|
14
|
+
## redirect ArticlesController, :show, id: 2, error: 'Access required'
|
15
|
+
def redirect(*args)
|
16
|
+
if args.last.is_a? Hash
|
17
|
+
add_controller_class(args)
|
18
|
+
parameters = args[0].instance_method(args[1]).parameters.map(&:last)
|
19
|
+
args[-1], flashes = args.last.partition do |key, _value|
|
20
|
+
parameters.include? key
|
21
|
+
end.map(&:to_h)
|
22
|
+
flash.merge(flashes)
|
23
|
+
end
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
11
27
|
private
|
12
28
|
|
29
|
+
## Main helper method
|
13
30
|
def flash(key = nil)
|
14
31
|
(
|
15
32
|
@flash ||= FlashArray.new(
|
data/lib/flame/flash_array.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flame-flash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flame
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 4.0.
|
22
|
+
version: 4.0.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 4.0.
|
32
|
+
version: 4.0.3
|
33
33
|
description: Show messages (notifies, errors, warnings) in current or next routes
|
34
34
|
after redirect.
|
35
35
|
email:
|