opto 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opto/option.rb +2 -4
- data/lib/opto/resolver.rb +22 -0
- data/lib/opto/resolvers/condition.rb +4 -0
- data/lib/opto/resolvers/evaluate.rb +4 -0
- data/lib/opto/resolvers/interpolate.rb +4 -0
- data/lib/opto/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d154fe92a61aa8299e7275cb82e22e659becbae
|
4
|
+
data.tar.gz: 572aff6816d0aaf364482f0543c6a68a30a5a981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4277e6893c6cc03226c982821c98079eb8154562f59405d7f0493b5a719dc1c105e8765791afa6f0e3c3bb881f399c5101003e09e200162341ad8b6f0d4ef0
|
7
|
+
data.tar.gz: 5b6bb2f4d14ade307209de3a83e2e97f45ab4cfd3c9f904388f100ffcdde2d8b5d7f85fa8a25fe216321d0971495db0451225d599b72fdc6828e91ef1c307a47
|
data/lib/opto/option.rb
CHANGED
@@ -199,13 +199,11 @@ module Opto
|
|
199
199
|
def resolve
|
200
200
|
resolvers.each do |resolver|
|
201
201
|
begin
|
202
|
-
|
203
|
-
result = resolver.resolve
|
204
|
-
resolver.respond_to?(:after) && resolver.after(self)
|
202
|
+
result = resolver.try_resolve
|
205
203
|
rescue StandardError => ex
|
206
204
|
raise ex, "Resolver '#{resolver.origin}' for '#{name}' : #{ex.message}"
|
207
205
|
end
|
208
|
-
|
206
|
+
unless result.nil?
|
209
207
|
@origin = resolver.origin
|
210
208
|
return result
|
211
209
|
end
|
data/lib/opto/resolver.rb
CHANGED
@@ -43,6 +43,28 @@ module Opto
|
|
43
43
|
def initialize(hint = nil, option = nil)
|
44
44
|
@hint = hint
|
45
45
|
@option = option
|
46
|
+
@tried = false
|
47
|
+
end
|
48
|
+
|
49
|
+
def tried?
|
50
|
+
!!@tried
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_tried
|
54
|
+
@tried = true
|
55
|
+
end
|
56
|
+
|
57
|
+
def reset_tried
|
58
|
+
@tried = false
|
59
|
+
end
|
60
|
+
|
61
|
+
def try_resolve
|
62
|
+
return nil if tried?
|
63
|
+
set_tried
|
64
|
+
self.respond_to?(:before) && self.before
|
65
|
+
result = resolve
|
66
|
+
self.respond_to?(:after) && self.after
|
67
|
+
result
|
46
68
|
end
|
47
69
|
|
48
70
|
# This is a "base" class, you're supposed to inherit from this in your resolver and define a #resolve method.
|
data/lib/opto/version.rb
CHANGED
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.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kimmo Lehto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|