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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7744e15c5aa0fc769954ed09eee485ae48e09c7
4
- data.tar.gz: 5e3399e68683e2c832867b15d7dd7ce83fccdddf
3
+ metadata.gz: 3597fd0a4fe2e3ee402bc43159dc23229910575d
4
+ data.tar.gz: 550e8867c47c8242bc01640c111fa149d8d24d36
5
5
  SHA512:
6
- metadata.gz: 8dfcf51ef06b9d77c5b7139339511e7d0800d11294f065a37cfcf412a805b3e67dcbd420672658f9797790294dfb19097fc4c70fccd9b8c5ec2e02e1f1ab96e4
7
- data.tar.gz: bf914ab418dc0266d1b89e794c275258f6b406481a9e44b67797eef035c2ee31aaa6554a22bad47a5f7a371f6a834ee76e4dc1b380e799376a2dcb2b3d5320c2
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
- @fail = :error
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 = new
61
- value = catch(:verbalize_error) { action.call }
62
- Result.new(outcome: action.outcome, value: value)
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.#{method_name} }",
15
- 'Result.new(outcome: action.outcome, value: value)'
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
 
@@ -1,3 +1,3 @@
1
1
  module Verbalize
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
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.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-09 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler