Sha256: 560a83ed3533075a26203c28ca50e7cf47a3129a8fe16b878c455886736b50d9

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module Rodakase
  module Transaction
    class Matcher
      attr_reader :result

      class Error
        attr_reader :result

        def initialize(result)
          @result = result
        end

        def on(code, &block)
          yield(result.value) if result.code == code
        end
      end

      def initialize(result)
        @result = result
      end

      def success(&block)
        yield(result.value) if result.success?
      end

      def failure(&block)
        yield(Error.new(result)) if result.failure?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rodakase-0.0.1 lib/rodakase/transaction/matcher.rb