flash_validators 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flash_validators/version.rb +1 -1
- data/lib/flash_validators.rb +27 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 868f39ce91250dfa8f7e3483c279d648bf55ac30
|
4
|
+
data.tar.gz: ee3618b918242696d58fb50d170b877f5f03f84a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a61abd3c4144c795d263fb59a35bb81cf93220b81d69eea649c4d9b317014691b7d57224b46c0731a848184d938c0738643b6e0d58a0955a93f0615a44388e
|
7
|
+
data.tar.gz: d4d253c2fdb4413f872cd9de4cb288462bd60ae425b42eeba747e5fafdc1a5236686cfc03e77aacca8c2e595ae151f34f8bdfe5bf10d3ec153349338452c830b
|
data/lib/flash_validators.rb
CHANGED
@@ -58,4 +58,31 @@ if defined?(RSpec)
|
|
58
58
|
require 'flash_validators/matchers/ensure_valid_url_format_of'
|
59
59
|
require 'flash_validators/matchers/ensure_valid_username_format_of'
|
60
60
|
require 'flash_validators/matchers/ensure_valid_uuid_format_of'
|
61
|
+
end
|
62
|
+
|
63
|
+
if defined?(Rails)
|
64
|
+
require 'rails'
|
65
|
+
|
66
|
+
module FlashValidators
|
67
|
+
class Railtie < ::Rails::Railtie #:nodoc:
|
68
|
+
initializer 'flash_validators' do |app|
|
69
|
+
FlashValidators::Railtie.instance_eval do
|
70
|
+
pattern = pattern_from app.config.i18n.available_locales
|
71
|
+
|
72
|
+
add(pattern)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
protected
|
77
|
+
|
78
|
+
def self.add(pattern)
|
79
|
+
I18n.load_path << File.expand_path("../../config/locales/#{pattern}.yml", __FILE__)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.pattern_from(args)
|
83
|
+
array = Array(args || [])
|
84
|
+
array.blank? ? '*' : "{#{array.join ','}}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
61
88
|
end
|