scintillation 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
data/lib/scintillation.rb CHANGED
@@ -14,6 +14,8 @@ module Scintillation
14
14
  include InstanceMethods
15
15
  ActionView::Base.send(:include, Scintillation::View)
16
16
 
17
+ options.reverse_merge!(:scope => :messages)
18
+
17
19
  # import flash messages
18
20
  before_filter { |c| c.send(:flash).each { |t, m| c.messages.add(m, t) } }
19
21
 
@@ -27,12 +29,10 @@ module Scintillation
27
29
 
28
30
  module InstanceMethods
29
31
  def method_missing(method, *args, &block)
30
- if /^((\w+)_)?msg(_for_(\w+))?$/.match(method.to_s)
31
- messages.add(args[0], $2, $4)
32
- elsif /^((\w+)_)?msgs$/.match(method.to_s)
33
- messages.get($2)
34
- else
35
- super
32
+ case method.to_s
33
+ when /^((\w+)_)?msg(_for_(\w+))?$/ then messages.add(args[0], $2, $4)
34
+ when /^((\w+)_)?msgs$/ then messages.get($2)
35
+ else super
36
36
  end
37
37
  end
38
38
  end
@@ -47,7 +47,7 @@ module Scintillation
47
47
 
48
48
  module InstanceMethods
49
49
  def method_missing(method, *args, &block)
50
- if /^((\w+)_)?msgs$/.match(method.to_s)
50
+ if method.to_s =~ /^((\w+)_)?msgs$/
51
51
  messages.get($2)
52
52
  else
53
53
  super
@@ -56,7 +56,7 @@ module Scintillation
56
56
 
57
57
  def display_messages(msgs)
58
58
  unless msgs.empty?
59
- "<ul>\n " + msgs.map { |m| "<li class=\"#{m.tone}\">#{m}</li>" }.join("\n ") + "\n</ul>"
59
+ "<ul>\n " + msgs.map { |m| "<li class=\"#{m.tone}\">#{m}</li>" }.join("\n ") + "\n</ul>".html_safe
60
60
  end
61
61
  end
62
62
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scintillation}
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Austin Schneider"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 5
9
- version: 1.0.5
8
+ - 6
9
+ version: 1.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Austin Schneider