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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc6d4eba7a43b4d9f517a88640c0d0d12144f2c6
4
- data.tar.gz: 2d4afb0d9cea7ee3fc7292ba21297dd2bd50d19b
3
+ metadata.gz: 34ea27d4523bf6286024a2be3100e5266f28487a
4
+ data.tar.gz: 8eb40fd2360612f052f68b9273556865288b313b
5
5
  SHA512:
6
- metadata.gz: 448eea08643b3d48a7a071c708d824b362779c0c0ca9703444f43347c06b4b22e3095bd7c20bf7f61a30c7276a30b68f2628fa5d07ce817b8abb2816316f0109
7
- data.tar.gz: 4e4d0d712ee78590da93426046c3c16c371ba05d320601f642da8ab6b01eb9e875d6819eb9e00fb2eecdfc65acbb6761995daee357422dc8aed6cbdbacb2c044
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(
@@ -48,6 +48,11 @@ module Flame
48
48
  @now.each(&block)
49
49
  end
50
50
 
51
+ ## Mass adding to next
52
+ def merge(hash)
53
+ hash.each { |type, text| self[type] = text }
54
+ end
55
+
51
56
  private
52
57
 
53
58
  def condition(hash, options = {}) # kind, section)
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.0.0
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-01-29 00:00:00.000000000 Z
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.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.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: