verbalize 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.md +2 -0
- data/lib/verbalize.rb +1 -1
- data/lib/verbalize/build_dangerous_action_method.rb +1 -1
- data/lib/verbalize/result.rb +9 -8
- 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: 1a62bdd3cdb29ee92c019943093d0808d2083531
|
4
|
+
data.tar.gz: 236446bbba2989ca23cab20956aeddedefd3b22b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d508c37312260b5916ffc08eb3d84fa73a7df7afe5220c143673d44d9cb384893a70281931f5c22aab1bd895eb29ed253ecb799c4442d788cf58da6e3ba2c0ba
|
7
|
+
data.tar.gz: 73e4886dd4c0f08ad21d7f7a134b8cb4949f34e4ef404f98a397ae5dbab338a62ff90613c0adb6772a7614ee9f3c6ba0834fde2638d6d99f470867b170f54480
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,9 @@ result = Add.call(a: 35, b: 7)
|
|
19
19
|
result.outcome # => :ok
|
20
20
|
result.value # => 42
|
21
21
|
result.succeeded? # => true
|
22
|
+
result.success? # alias for succeeded? => true
|
22
23
|
result.failed? # => false
|
24
|
+
result.failure? # alias for failed? => false
|
23
25
|
|
24
26
|
outcome, value = Add.call(a: 35, b: 7)
|
25
27
|
outcome # => :ok
|
data/lib/verbalize.rb
CHANGED
@@ -73,7 +73,7 @@ module Verbalize
|
|
73
73
|
def call!
|
74
74
|
new.send(:call)
|
75
75
|
rescue UncaughtThrowError => uncaught_throw_error
|
76
|
-
fail_value = uncaught_throw_error.value.
|
76
|
+
fail_value = uncaught_throw_error.value.value
|
77
77
|
error = VerbalizeError.new("Unhandled fail! called with: #{fail_value.inspect}.")
|
78
78
|
error.set_backtrace(uncaught_throw_error.backtrace[2..-1])
|
79
79
|
raise error
|
@@ -12,7 +12,7 @@ module Verbalize
|
|
12
12
|
<<-BODY.chomp
|
13
13
|
new(#{initialize_keywords_and_values}).send(:#{method_name})
|
14
14
|
rescue UncaughtThrowError => uncaught_throw_error
|
15
|
-
error = VerbalizeError.new("Unhandled fail! called with: \#{uncaught_throw_error.value.
|
15
|
+
error = VerbalizeError.new("Unhandled fail! called with: \#{uncaught_throw_error.value.value.inspect}.")
|
16
16
|
error.set_backtrace(uncaught_throw_error.backtrace[2..-1])
|
17
17
|
raise error
|
18
18
|
BODY
|
data/lib/verbalize/result.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
module Verbalize
|
2
|
-
class Result
|
2
|
+
class Result
|
3
3
|
def initialize(outcome:, value:)
|
4
|
-
|
4
|
+
@outcome = outcome
|
5
|
+
@value = value
|
5
6
|
end
|
6
7
|
|
8
|
+
attr_reader :outcome, :value
|
9
|
+
|
7
10
|
def succeeded?
|
8
11
|
!failed?
|
9
12
|
end
|
13
|
+
alias_method :success?, :succeeded?
|
10
14
|
|
11
15
|
def failed?
|
12
16
|
outcome == :error
|
13
17
|
end
|
18
|
+
alias_method :failure?, :failed?
|
14
19
|
|
15
|
-
def
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def value
|
20
|
-
last
|
20
|
+
def to_ary
|
21
|
+
[outcome, value]
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
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.
|
4
|
+
version: 1.2.0
|
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-
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|