env_bang 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -69,7 +69,7 @@ is not met, a KeyError will be raised with an explanation of what needs to be co
69
69
  ### Adding a default value
70
70
 
71
71
  For some variables, you’ll want to include a default value in your code, and allow each
72
- environment to ommit the variable for default behavios. You can accomplish this with the
72
+ environment to ommit the variable for default behaviors. You can accomplish this with the
73
73
  `:default` option:
74
74
 
75
75
  ```ruby
@@ -10,7 +10,7 @@ class ENV_BANG
10
10
  if File.exists?(env_rb_file)
11
11
  load env_rb_file
12
12
  else
13
- Rails.logger.warn "ENV! could not find your environment variable configuration. Please create #{env_rb_file} to set set up environment variables at Rails boot."
13
+ Rails.logger.warn "ENV! could not find your environment variable configuration. Please create #{env_rb_file} to set up environment variables at Rails boot."
14
14
  end
15
15
  end
16
16
  end
@@ -16,9 +16,8 @@ class ENV_BANG
16
16
  end
17
17
 
18
18
  def Array(value, options)
19
- options.delete(:class)
20
- options[:class] = options[:of] if options[:of]
21
- value.split(',').map { |value| cast(value.strip, options) }
19
+ item_options = options.merge(class: options.fetch(:of, default_class))
20
+ value.split(',').map { |v| cast(v.strip, item_options) }
22
21
  end
23
22
 
24
23
  def Symbol(value, options)
@@ -1,3 +1,3 @@
1
1
  class ENV_BANG
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -90,6 +90,15 @@ describe ENV_BANG do
90
90
  ENV!['FLOATS'].must_equal floats.map(&:to_f)
91
91
  end
92
92
 
93
+ it "regression: Casting Array always returns Array" do
94
+ ENV['ARRAY'] = 'one,two , three, four'
95
+ ENV!.use 'ARRAY', class: Array
96
+
97
+ 2.times do
98
+ ENV!['ARRAY'].must_equal %w[one two three four]
99
+ end
100
+ end
101
+
93
102
  it "Casts true" do
94
103
  ENV['TRUE'] = truthy_values.sample
95
104
  ENV!.use 'TRUE', class: :boolean
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_bang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jonathan Camenisch
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-03 00:00:00.000000000 Z
12
+ date: 2015-02-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ">="
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: minitest
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - "~>"
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - "~>"
39
44
  - !ruby/object:Gem::Version
@@ -64,26 +69,27 @@ files:
64
69
  homepage: https://github.com/jcamenisch/ENV_BANG
65
70
  licenses:
66
71
  - MIT
67
- metadata: {}
68
72
  post_install_message:
69
73
  rdoc_options: []
70
74
  require_paths:
71
75
  - lib
72
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
73
78
  requirements:
74
79
  - - ">="
75
80
  - !ruby/object:Gem::Version
76
81
  version: '0'
77
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
78
84
  requirements:
79
85
  - - ">="
80
86
  - !ruby/object:Gem::Version
81
87
  version: '0'
82
88
  requirements: []
83
89
  rubyforge_project:
84
- rubygems_version: 2.2.0
90
+ rubygems_version: 1.8.24
85
91
  signing_key:
86
- specification_version: 4
92
+ specification_version: 3
87
93
  summary: Do a bang-up job managing your environment variables
88
94
  test_files:
89
95
  - test/env_bang_test.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: dfe99ce78ee95e20f85bd9467d2131b39550dd78
4
- data.tar.gz: a24392f5e44fbcc89903e5c73d365eefd74d86d1
5
- SHA512:
6
- metadata.gz: 9081e3b9ee0253b58ba4f1eb6561e1afc4d988c468b0b4a68a98b86442afde16c97a847b32b028cbc03a987763fb8f5f390f045b8c44231604603d172115df92
7
- data.tar.gz: 180d9a2a0d823caec0f48dbb4f15e99329b82d69d058b6b703d6a865ddb01ae8a44bd14ed6969ab216b2cfc70e4a544076abd4624b0983905177ba30205f0765