flash_rails_messages 2.2.0 → 2.3.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
  SHA256:
3
- metadata.gz: '085d22b26171272caa263d4ebe35e7da1be85702e8ada39bbb33a620e3011c7d'
4
- data.tar.gz: 24b92fbd4b5b17ccea14c083ed03f97f0312dcdcf104e280b7af4395592f17f1
3
+ metadata.gz: 50dcc71888ef680be0e9596e6ffdc4009288abe1a9f9112e67de48a261e0512b
4
+ data.tar.gz: cb30d724c044b9ccdb90409bc0885eef49ea9f65c4507cf7195393ec9364d0f3
5
5
  SHA512:
6
- metadata.gz: 85303aaa06af48767a9a44021a517c1f6b416a92dacd2e663d3a56ee7be31f3c94bb062bc082b74c2b49c48dded3752b4f8bdfb63d67d94364063115e3f9aad6
7
- data.tar.gz: c0fc9b4312312cdb0a9d992893c47ddd83926dfcc548eea6130b4db328544e0f7d2170ba7d2fc31c42dc163304af8ad6970055dc6956b7e96384142aab46241e
6
+ metadata.gz: 9f1f08a2b0048cc522d363a2cce87da735a6a38225faa004000734265ce9d75376238ba2528dbbf768fa03afc20a46bee392a2ff3aa91f7888fb3d97d9f3c635
7
+ data.tar.gz: 8d04a2aceb162909dad3e1f55312c093c1536a2500ddf30f309cea66ed5038951150c9dbc1b4861d363c6deed1a32d4c25dc3828e5522a4a9a21aef4bd6f52c9
@@ -10,13 +10,22 @@ module FlashRailsMessages
10
10
  end
11
11
 
12
12
  def render(flash)
13
- flash = Hash[flash].symbolize_keys
14
- flash.map { |message| alert_element(*message) }.join.html_safe
13
+ messages(flash).map do |message|
14
+ alert_element(*message)
15
+ end.join.html_safe
15
16
  end
16
17
 
17
18
  private
18
19
 
20
+ def messages(flash)
21
+ Hash[flash]
22
+ .symbolize_keys
23
+ .keep_if { |key, _| alert_type_classes.include?(key) }
24
+ end
25
+
19
26
  def alert_element(type, message)
27
+ return unless message.respond_to?(:html_safe)
28
+
20
29
  content_tag :div, alert_options(type) do
21
30
  content = ActiveSupport::SafeBuffer.new
22
31
  content += close_element if options.fetch(:dismissible, false)
@@ -58,7 +67,6 @@ module FlashRailsMessages
58
67
  {}
59
68
  end
60
69
 
61
- def custom_alert_classes
62
- end
70
+ def custom_alert_classes; end
63
71
  end
64
72
  end
@@ -1,3 +1,3 @@
1
1
  module FlashRailsMessages
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flash_rails_messages
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Gutiérrez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-06 00:00:00.000000000 Z
11
+ date: 2021-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.2.3
152
+ rubygems_version: 3.2.32
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: This gems provides an easy way to display flash rails messages