env_bang 0.2.8 → 0.2.8.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
  SHA1:
3
- metadata.gz: 75f9cc5013ad1fb2d5f0ee0662da09b492e28470
4
- data.tar.gz: 30f9f2473f6d747fb9079082221d0fffd94560c7
3
+ metadata.gz: ec44b0eec6674b6a0cdf6f16989121a5bda0d79b
4
+ data.tar.gz: 58a68baf89c28c817f8b543cb5ec485aa83bef6f
5
5
  SHA512:
6
- metadata.gz: 485ac95c1327653a3b9e0224e728202484217ab3753267b6f8457c3065c00fbd75d2b9b25d72d26b426fba9da90e03fdcd82ff371dce348ab5c4c2c6af1ce4e5
7
- data.tar.gz: 82e8491ea7ad0a668c6b57cd388b56e1e0eb516a3bfcef0b817ac0205d50a1036f4e1c908a3ff87f1f119a39e9c1f172456758b03f9c44c8ee93b8f9e829ada3
6
+ metadata.gz: a92587c42bda2d877ecb4fe61b7358579ec7869c01afd064c722dc87e46f278b6a4ad94cec923180d0a98e2ef13ba7383eb583a26738a54e8744d4bea8e20764
7
+ data.tar.gz: 7fd541f39092230c9a3e84775b0be6aac4a4c9fd345efb4ff5659535732fa7450c2f67bc6db707a640c1c32b5cfb0f02fdb6c54d9930a3cb8645e3d2dd698f2e
data/README.md CHANGED
@@ -27,7 +27,7 @@ gem 'env_bang'
27
27
  Or for Rails apps, use `env_bang-rails` instead for more convenience:
28
28
 
29
29
  ```ruby
30
- gem 'env_bang-rails
30
+ gem 'env_bang-rails'
31
31
  ```
32
32
 
33
33
  And then execute:
@@ -133,8 +133,9 @@ set
133
133
 
134
134
  ```ruby
135
135
  ENV!.config do
136
- Classes.default_class = String
136
+ default_class String
137
137
  end
138
+ ```
138
139
 
139
140
  #### Custom type conversion
140
141
 
@@ -1,3 +1,3 @@
1
1
  class ENV_BANG
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.8.1"
3
3
  end
data/lib/env_bang.rb CHANGED
@@ -9,6 +9,7 @@ class ENV_BANG
9
9
 
10
10
  def clear_config
11
11
  @vars = {}
12
+ default_class nil
12
13
  end
13
14
 
14
15
  def use(var, *args)
@@ -54,12 +55,12 @@ class ENV_BANG
54
55
  Classes.send :define_singleton_method, klass.to_s, &block
55
56
  end
56
57
 
57
- def default_class
58
- Classes.default_class
59
- end
60
-
61
- def default_class=(value)
62
- Classes.default_class = value
58
+ def default_class(*args)
59
+ if args.any?
60
+ Classes.default_class = args.first
61
+ else
62
+ Classes.default_class
63
+ end
63
64
  end
64
65
  end
65
66
 
@@ -118,7 +118,8 @@ describe ENV_BANG do
118
118
  end
119
119
 
120
120
  it "allows default class to be overridden" do
121
- ENV!.config { default_class = String }
121
+ ENV!.default_class.must_equal :StringUnlessFalsey
122
+ ENV!.config { default_class String }
122
123
  ENV['FALSE'] = falsey_values.sample
123
124
  ENV!.use 'FALSE', class: String
124
125
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_bang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Camenisch