settable 3.0.2 → 3.0.3
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.
- checksums.yaml +4 -4
- data/Readme.md +2 -0
- data/lib/settable.rb +7 -2
- data/spec/settable_spec.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e757786a0227bb7e622eca0d85eef196c9da8fa
|
4
|
+
data.tar.gz: 445a6dcecc98a26803c91ce72b1586c564c38dae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dcc7c188edaab0e0f32e4156f0f9a8ef8635319b929ef4f704d1133ab44447373a4ef96e47f7a0decc7b1f830aa0954432f87790b9b88b8a3ec7b4d1f653bfe
|
7
|
+
data.tar.gz: fdb229a12445f0cdac3c7de0474f90cc207ceca3f28821d96f54d7faac5ac34c93a2b8f1501047d0bf825d06e227cf10c9defc8f66014cd4625212601f42b669
|
data/Readme.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/robhurring/settable)
|
4
4
|
|
5
|
+
[](http://badge.fury.io/rb/settable)
|
6
|
+
|
5
7
|
An alternative to using rails' environment files or YAML for application config. Settable was created out of the frustration of
|
6
8
|
missing a config setting in an environment file, or constantly duplicating YAML keys for different environments. Settable helps
|
7
9
|
make your config "safe" by always having a default value, and its built using Ruby so it is highly customizable and powerful.
|
data/lib/settable.rb
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
# # => true
|
30
30
|
#
|
31
31
|
module Settable
|
32
|
-
VERSION = '3.0.
|
32
|
+
VERSION = '3.0.3'
|
33
33
|
|
34
34
|
# name of the top-level namespace when none is provided
|
35
35
|
ROOT_NAMESPACE = :__settable__
|
@@ -133,7 +133,12 @@ module Settable
|
|
133
133
|
def call
|
134
134
|
@__env_return_value__ = nil # avoid using throw/catch
|
135
135
|
default_return_value = instance_eval &@block
|
136
|
-
|
136
|
+
|
137
|
+
if @__env_return_value__.nil?
|
138
|
+
default_return_value
|
139
|
+
else
|
140
|
+
@__env_return_value__
|
141
|
+
end
|
137
142
|
end
|
138
143
|
|
139
144
|
private
|
data/spec/settable_spec.rb
CHANGED
@@ -74,6 +74,19 @@ describe Settable::Environment do
|
|
74
74
|
c.key.should eq 'value'
|
75
75
|
end
|
76
76
|
|
77
|
+
it 'should handle false correctly from env' do
|
78
|
+
c = Settable.configure do
|
79
|
+
use_environment EnvTester
|
80
|
+
|
81
|
+
set :something_enabled do
|
82
|
+
environment :test, false
|
83
|
+
true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
c.something_enabled.should be_false
|
88
|
+
end
|
89
|
+
|
77
90
|
it 'should default unless matched' do
|
78
91
|
c = Settable.configure do
|
79
92
|
use_environment EnvTester
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Hurring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -69,3 +69,4 @@ summary: Small include to make config files better
|
|
69
69
|
test_files:
|
70
70
|
- spec/settable_spec.rb
|
71
71
|
- spec/spec_helper.rb
|
72
|
+
has_rdoc:
|