opto 1.4.0 → 1.5.0

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: 01abb09f30890132075384eb8ff969899b0fb168
4
- data.tar.gz: 51d608217ef7b48968d66a75ae2e8515c38c4d9d
3
+ metadata.gz: 9b14c43a8bb5fd247a9055fad5a034cdf105a105
4
+ data.tar.gz: 609d7736dd12d4122767c805a6a6f359ccdee237
5
5
  SHA512:
6
- metadata.gz: 66121b1275518c5023ee8e2a4633e7835f3cff613c6173bc18debe8a1b29905f0913f13a4b1579e83d46f8fd4f049ebb17a2936497660c3fda1d1c2471446a07
7
- data.tar.gz: 89ecd251166c29beeae9bcb96962d7d873215d9f55225e7c6813050fa1b772b400497977289594549a182e51e0098e498887e0a8bd38c0a0b17e0c80c2d66494
6
+ metadata.gz: 7252a233ceb798d1215494de81c07c8b578022126afc092273ee1f5a71fa22f3c1fdec8ed80d4f801194c308e62b1e6dd6e56c77425aece2230db952ab174d6a
7
+ data.tar.gz: c71d75fed79a2123c5848a742e77d108fe8d5287cc24516bd29680f40d75f5d83acb8d459ee4f763214012fb037ba00bf43f5d99786b76c86409e48c1e99dc99
@@ -93,7 +93,7 @@ module Opto
93
93
  @only_if = opts.delete(:only_if)
94
94
  @skip_lambdas = normalize_ifs(@skip_if)
95
95
  @only_lambdas = normalize_ifs(@only_if)
96
- @from = { default: self }.merge(normalize_from_to(opts.delete(:from)))
96
+ @from = normalize_from_to(opts.delete(:from))
97
97
  @to = normalize_from_to(opts.delete(:to))
98
98
  @type_options = opts
99
99
 
@@ -186,7 +186,7 @@ module Opto
186
186
  # Accessor to defined resolvers for this option.
187
187
  # @return [Array<Opto::Resolver>]
188
188
  def resolvers
189
- @resolvers ||= from.map { |origin, hint| Resolver.for(origin).new(hint, self) }
189
+ @resolvers ||= from.merge(default: self).map { |origin, hint| Resolver.for(origin).new(hint, self) }
190
190
  end
191
191
 
192
192
  def setters
@@ -1,3 +1,3 @@
1
1
  module Opto
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Kimmo Lehto"]
10
10
  spec.email = ["info@kontena.io"]
11
11
 
12
- spec.summary = "Create validatable and resolvable options from hashes"
13
- spec.description = "Example: Opto.new(type: :string, name: 'foo, min_length: 20, from: { env: 'FOO' }).value"
12
+ spec.summary = "Option validator / resolver"
13
+ spec.description = "Create validatable and resolvable options from hashes or YAML. Example: Opto.new(type: :string, name: 'FOO', min_length: 20, from: :env).valid?"
14
14
  spec.homepage = "https://github.com/kontena/opto"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kimmo Lehto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,8 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: 'Example: Opto.new(type: :string, name: ''foo, min_length: 20, from:
56
- { env: ''FOO'' }).value'
55
+ description: 'Create validatable and resolvable options from hashes or YAML. Example:
56
+ Opto.new(type: :string, name: ''FOO'', min_length: 20, from: :env).valid?'
57
57
  email:
58
58
  - info@kontena.io
59
59
  executables:
@@ -115,5 +115,5 @@ rubyforge_project:
115
115
  rubygems_version: 2.4.5
116
116
  signing_key:
117
117
  specification_version: 4
118
- summary: Create validatable and resolvable options from hashes
118
+ summary: Option validator / resolver
119
119
  test_files: []