lib/substation/response.rb in substation-0.0.10.beta2 vs lib/substation/response.rb in substation-0.0.10

- old
+ new

@@ -1,5 +1,7 @@ +# encoding: utf-8 + module Substation # Base class for action responses # # The following code illustrates context and serves as setup for all @@ -127,42 +129,25 @@ # true if successful, false otherwise # # @api public abstract_method :success? - # An errorneous {Response} - class Failure < self - - # Tests wether this response was successful - # - # @example - # - # response = dispatcher.call(:failing_action, :some_input) - # response.success? # => false - # - # @return [false] - # - # @api public - def success? - false - end + # Test wether processing raised an exception + # + # @return [true] + # + # @api private + def exception? + false end - # A successful {Response} - class Success < self - - # Tests wether this response was successful - # - # @example - # - # response = dispatcher.call(:successful_action, :some_input) - # response.success? # => true - # - # @return [true] - # - # @api public - def success? - true - end + # Return a {Request} instance built upon this response + # + # @return [Request] + # + # @api private + def to_request(new_input = output) + Request.new(request.name, env, new_input) end - end -end + + end # class Response +end # module Substation