lib/verbalize.rb in verbalize-1.0.0 vs lib/verbalize.rb in verbalize-1.0.1

- old
+ new

@@ -3,16 +3,12 @@ require 'verbalize/build_action_method' require 'verbalize/build_attribute_readers' require 'verbalize/result' module Verbalize - def outcome - @outcome = @fail || :ok - end - def fail!(failure_value) - @fail = :error + @verbalize_outcome = :error throw :verbalize_error, failure_value end def self.included(target) target.extend ClassMethods @@ -55,11 +51,12 @@ attributes: required_keywords + optional_keywords ) end def call - action = new - value = catch(:verbalize_error) { action.call } - Result.new(outcome: action.outcome, value: value) + action = new + value = catch(:verbalize_error) { action.send(:call) } + outcome = action.instance_variable_get(:@verbalize_outcome) || :ok + Result.new(outcome: outcome, value: value) end end end