rails-settings-cached 2.0.0 → 2.0.1

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: e89d0b87824703140e5d9182ade7936b22045bde791ba86d805dfbde9614f7b7
4
- data.tar.gz: 2a3643dd2c6b3b837c3a4b1361651ca0a5b468336e038a38d1aaaa3bc659e151
3
+ metadata.gz: dc90c161735c2de3ceef1814d8c93706422860bfa444407717862ded1ee4efb4
4
+ data.tar.gz: 50538a15a02ad109a05ef5d09bebe2a2dc4530f8b393348f4a86b32521fb3917
5
5
  SHA512:
6
- metadata.gz: e6b9209c170d1b5d34b62496533936c4e8598bc963fb5bd1fbb3a8c5b86424e6c7986fb300eb4aebc89ce7e13f86d083588bef06e93c5c6927b18ccf2465e5e6
7
- data.tar.gz: 7b7b05d0794663008292b3630c99c160f8fc54cc0b9e8b958d46052cb63ce94f9eff4d012d06b2676551cfc805502d890e5313a887d3611bfb6fdbd0ffb2d3d9
6
+ metadata.gz: b3b3c1d7730b48f11a90c5d1a0ff9ee07dccade17b7dd31ce6fb8988449a12a265cbb8349c61416d7663ea7e629fa92f41ea4756e44c2b862522f7172a81f3ee
7
+ data.tar.gz: 116a49dc9ea61533e11c0ccad5ec0138093db6f051b6319219259e084e2c4fa2bca06e098d939b6de0c1e3ca4dadd533a0fa0c5db939c2ea15c187c623e9c1cf
@@ -7,4 +7,6 @@ class <%= class_name %> < RailsSettings::Base
7
7
  # field :default_locale, default: "en", type: :string
8
8
  # field :confirmable_enable, default: "0", type: :boolean
9
9
  # field :admin_emails, default: "admin@rubyonrails.org", type: :array
10
+ # field :omniauth_google_client_id, default: (ENV["OMNIAUTH_GOOGLE_CLIENT_ID"] || ""), type: :string, readonly: true
11
+ # field :omniauth_google_client_secret, default: (ENV["OMNIAUTH_GOOGLE_CLIENT_SECRET"] || ""), type: :string, readonly: true
10
12
  end
@@ -39,22 +39,26 @@ module RailsSettings
39
39
 
40
40
  private
41
41
  def _define_field(key, default: nil, type: :string, readonly: false)
42
- self.class.define_method(key) do
43
- val = self.send(:_value_of, key)
44
- result = nil
45
- if !val.nil?
46
- result = val
47
- else
48
- result = default
49
- result = default.call if default.is_a?(Proc)
42
+ if readonly
43
+ self.class.define_method(key) do
44
+ self.send(:_covert_string_to_typeof_value, type, default)
50
45
  end
46
+ else
47
+ self.class.define_method(key) do
48
+ val = self.send(:_value_of, key)
49
+ result = nil
50
+ if !val.nil?
51
+ result = val
52
+ else
53
+ result = default
54
+ result = default.call if default.is_a?(Proc)
55
+ end
51
56
 
52
- result = self.send(:_covert_string_to_typeof_value, type, result)
57
+ result = self.send(:_covert_string_to_typeof_value, type, result)
53
58
 
54
- result
55
- end
59
+ result
60
+ end
56
61
 
57
- unless readonly
58
62
  self.class.define_method("#{key}=") do |value|
59
63
  var_name = key.to_s
60
64
 
@@ -3,7 +3,7 @@
3
3
  module RailsSettings
4
4
  class << self
5
5
  def version
6
- "2.0.0"
6
+ "2.0.1"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-settings-cached
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee