flash-message-conductor 2.0.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,20 @@ module FlashMessageConductor
5
5
  module ClassMethods
6
6
  end
7
7
  FLASH_MESSAGE_TYPES.each do |message_type|
8
- define_method("add_#{message_type.to_s}") { |message| flash[message_type] = message}
8
+ define_method("add_#{message_type.to_s}") do |message, *options|
9
+ options = options.first || Hash.new
10
+
11
+ flash[message_type] = message
12
+
13
+ case options[:state]
14
+ when :discard
15
+ flash.discard(message_type)
16
+ when :now
17
+ flash.now[message_type] = message
18
+ when :keep
19
+ flash.keep(message_type)
20
+ end
21
+ end
9
22
  end
10
23
 
11
24
  def flash_message_set?
@@ -1,3 +1,3 @@
1
1
  module FlashMessageConductor
2
- VERSION = "2.0.1"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flash-message-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-05 00:00:00.000000000 Z
13
+ date: 2013-05-30 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: A simple pattern for managing flash messages in your Ruby on Rails application
16
16
  email: