rails-env 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-env/version.rb +1 -1
- data/lib/rails-env.rb +17 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0846ba4fc417659c73a8849eac8b8693c0e8229e
|
4
|
+
data.tar.gz: 4498c4c51ba6f1c4ccace8ce1c7d152a5becb49b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e1f75229a36c048954fe40a37f033bb089c2d772d9d07a8604514b7153e4e3e4e54fad2308b66329b56a3b3393a80e22a4a9406f13a3ac21a5e9eed7ad5811f
|
7
|
+
data.tar.gz: 18c7b6a3a2b3df7399775f74c3e003b81b6d2203ae057cd98927e6902bc91990ffe46fe9f7e3a05d5ce59d29930290d2e4c8032d067d66189902d8523ceb433d
|
data/lib/rails-env/version.rb
CHANGED
data/lib/rails-env.rb
CHANGED
@@ -7,20 +7,34 @@ module RailsEnv
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.config
|
11
|
+
Rails.configuration
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.propagate_configuration!
|
11
15
|
propagate(:action_mailer, '::ActionMailer::Base')
|
12
16
|
propagate(:active_record, '::ActiveRecord::Base')
|
13
17
|
propagate(:active_job, '::ActiveJob::Base')
|
14
18
|
propagate(:time_zone, '::Time', :zone)
|
15
|
-
|
19
|
+
propagate_i18n
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.propagate_i18n
|
23
|
+
I18n.available_locales = (config.i18n.available_locales || [])
|
24
|
+
.compact
|
25
|
+
.map(&:to_sym)
|
26
|
+
.uniq
|
27
|
+
I18n.default_locale = config.i18n.default_locale if config.i18n.default_locale
|
28
|
+
I18n.locale = config.i18n.locale if config.i18n.locale
|
29
|
+
I18n.load_path += config.i18n.load_path if config.i18n.load_path
|
16
30
|
end
|
17
31
|
|
18
32
|
def self.propagate(options_name, target_name, target_property = nil)
|
19
33
|
return unless Object.const_defined?(target_name)
|
20
|
-
return unless
|
34
|
+
return unless config.respond_to?(options_name)
|
21
35
|
|
22
36
|
target = Object.const_get(target_name)
|
23
|
-
options =
|
37
|
+
options = config.public_send(options_name)
|
24
38
|
|
25
39
|
if options.kind_of?(Enumerable)
|
26
40
|
options.each do |key, value|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|