env_vars 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +1 -0
  3. data/env_vars.gemspec +2 -2
  4. data/lib/env_vars.rb +11 -1
  5. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ea60318c5b3551b75421b50696aeda6d9fe2262d
4
- data.tar.gz: 58a80b5e1c90243a78921512ce6f1b6b579dc459
2
+ SHA256:
3
+ metadata.gz: 41c6b90fcfd8b5c85a223b3f8e55405ac95f0b35c086f71215f220bb128177d2
4
+ data.tar.gz: 4c1eda047bd3fee74ddb814ca4e4f699b13bc67eab4c4fb1fbbedadf3bba55b7
5
5
  SHA512:
6
- metadata.gz: fd932edac1256b348f2575243632971f496e07e561a3e5edfc52180aa118c770357e052c556bc4bb2d84a8a148825435bf514a367689debdadbee8b241046e19
7
- data.tar.gz: b04854b098b359b9a38a1e621b38d3d05ebe814a65cd0621abee30c41ce70099d62cb22e581ab25fb900568c83773eafa76b556123e06260b4682e3b6c910bab
6
+ metadata.gz: bcf4772a021653e00637b406e497445e3c1c05920a989db4e2af25c8bef45b3343d68c13e48054ce18fbc3e5058d304906d1c384d7369936e3e7f5c8e17364ca
7
+ data.tar.gz: 60ae05344958e4d5c8ba682e42fdea538b62774a26ba1fb8ca9d95e1113c6b41a3d4cfd16fb17af4206d525802e3fd5293bd638e6f69f1456c9692d3a6d75a56
data/README.md CHANGED
@@ -68,6 +68,7 @@ You can coerce values to the following types:
68
68
  - `string`: Is the default. E.g. `optional :name, string`.
69
69
  - `int`: E.g. `optional :timeout, int`.
70
70
  - `float`: E.g. `optional :wait, float`.
71
+ - `bigdecimal`: E.g. `optional :fee, bigdecimal`.
71
72
  - `bool`: E.g. `optional :force_ssl, bool`. Any of `yes`, `true` or `1` is considered as `true`. Any other value will be coerced to `false`.
72
73
  - `symbol`: E.g. `optional :app_name, symbol`.
73
74
  - `array`: E.g. `optional :chars, array` or `optional :numbers, array(int)`. The environment variable must be something like `a,b,c`.
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
16
16
  spec.require_paths = ["lib"]
17
17
 
18
- spec.add_development_dependency "bundler", "~> 1.10"
19
- spec.add_development_dependency "rake", "~> 10.0"
18
+ spec.add_development_dependency "bundler"
19
+ spec.add_development_dependency "rake"
20
20
  spec.add_development_dependency "minitest"
21
21
  spec.add_development_dependency "minitest-utils"
22
22
  spec.add_development_dependency "simplecov"
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Env
4
6
  class Vars
5
- VERSION = "0.5.0"
7
+ VERSION = "0.6.0"
6
8
  BOOL_TRUE = ["yes", "true", "1", true]
7
9
  BOOL_FALSE = ["no", "false"]
8
10
 
@@ -76,6 +78,10 @@ module Env
76
78
  :float
77
79
  end
78
80
 
81
+ def bigdecimal
82
+ :bigdecimal
83
+ end
84
+
79
85
  def array(type = string)
80
86
  [:array, type]
81
87
  end
@@ -98,6 +104,10 @@ module Env
98
104
  Float(value) if value
99
105
  end
100
106
 
107
+ def coerce_to_bigdecimal(value)
108
+ BigDecimal(value) if value
109
+ end
110
+
101
111
  def coerce_to_symbol(value)
102
112
  value && value.to_sym
103
113
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_vars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-10 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.6.13
121
+ rubygems_version: 2.7.6
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Access environment variables. Also includes presence validation, type coercion