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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54be7bfad6d607eb1031afc41ebd006000b28ccd
4
- data.tar.gz: 7008dff976d48c3a821d6ee4ae97c6c111ffdc60
3
+ metadata.gz: 0846ba4fc417659c73a8849eac8b8693c0e8229e
4
+ data.tar.gz: 4498c4c51ba6f1c4ccace8ce1c7d152a5becb49b
5
5
  SHA512:
6
- metadata.gz: 8fa0ca1dbe54d9d6b98b22096be6f5c9c7624121b177016b57ff2509140c628b44fddf3d3366b5fb77bc1f99b63a8ac8cdfc27e28ccc1156b867b1a49778006c
7
- data.tar.gz: da0fdf44a876a8100ea0cdb69ddf1cfe315ec95040553686ca31794cb7d9557737c833fe97a40213df50a4deb1e17152d0f15d8beb553371b2bf53e8181f1c89
6
+ metadata.gz: 6e1f75229a36c048954fe40a37f033bb089c2d772d9d07a8604514b7153e4e3e4e54fad2308b66329b56a3b3393a80e22a4a9406f13a3ac21a5e9eed7ad5811f
7
+ data.tar.gz: 18c7b6a3a2b3df7399775f74c3e003b81b6d2203ae057cd98927e6902bc91990ffe46fe9f7e3a05d5ce59d29930290d2e4c8032d067d66189902d8523ceb433d
@@ -1,3 +1,3 @@
1
1
  module RailsEnv
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
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
- propagate(:i18n, '::I18n')
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 Rails.configuration.respond_to?(options_name)
34
+ return unless config.respond_to?(options_name)
21
35
 
22
36
  target = Object.const_get(target_name)
23
- options = Rails.configuration.public_send(options_name)
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.1
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-23 00:00:00.000000000 Z
11
+ date: 2015-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler