verbalize 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/verbalize.rb +5 -8
- data/lib/verbalize/build_action_method.rb +3 -2
- data/lib/verbalize/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: 3597fd0a4fe2e3ee402bc43159dc23229910575d
|
4
|
+
data.tar.gz: 550e8867c47c8242bc01640c111fa149d8d24d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 042bc2b94824e56ef38fbd5ca2c0959f92e3ed95cb3fda6aa6a4eeeead5c31763ead385a42e9068c44d23ee52e7f689facfaaf6f9ee8d0694c4b283f8e10966d
|
7
|
+
data.tar.gz: 2e5611c685bf82d323017990fc5040c61d7cd32bee5a1359760ce3b8830fda7be9dba43c1cc06216c132737e385c1aa8c790e91740f13ef650166c34051b2433
|
data/lib/verbalize.rb
CHANGED
@@ -5,12 +5,8 @@ require 'verbalize/build_attribute_readers'
|
|
5
5
|
require 'verbalize/result'
|
6
6
|
|
7
7
|
module Verbalize
|
8
|
-
def outcome
|
9
|
-
@outcome = @fail || :ok
|
10
|
-
end
|
11
|
-
|
12
8
|
def fail!(failure_value)
|
13
|
-
@
|
9
|
+
@verbalize_outcome = :error
|
14
10
|
throw :verbalize_error, failure_value
|
15
11
|
end
|
16
12
|
|
@@ -57,9 +53,10 @@ module Verbalize
|
|
57
53
|
end
|
58
54
|
|
59
55
|
def call
|
60
|
-
action
|
61
|
-
value
|
62
|
-
|
56
|
+
action = new
|
57
|
+
value = catch(:verbalize_error) { action.send(:call) }
|
58
|
+
outcome = action.instance_variable_get(:@verbalize_outcome) || :ok
|
59
|
+
Result.new(outcome: outcome, value: value)
|
63
60
|
end
|
64
61
|
end
|
65
62
|
end
|
@@ -11,8 +11,9 @@ module Verbalize
|
|
11
11
|
def body
|
12
12
|
[
|
13
13
|
"action = new(#{initialize_keyword_arguments})",
|
14
|
-
"value = catch(:verbalize_error) { action
|
15
|
-
'
|
14
|
+
"value = catch(:verbalize_error) { action.send(#{method_name.inspect}) }",
|
15
|
+
'outcome = action.instance_variable_get(:@verbalize_outcome) || :ok',
|
16
|
+
'Result.new(outcome: outcome, value: value)'
|
16
17
|
].join("\n")
|
17
18
|
end
|
18
19
|
|
data/lib/verbalize/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verbalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|