Sha256: 36fddc7e121cbcb481e8daf602b307ab5e1e883447d45a9928ffcd426d69c847

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module Monri
  class Response < Hash

    def initialize(params = {})
      if params.has_key?(:exception)
        self[:exception] = params[:exception]
      end
      self.merge!(params)
    end

    # @return [Exception, NilClass]
    def exception
      self[:exception]
    end

    # @param [Exception] val
    def exception=(val)
      self[:exception] = val
    end

    def failed?
      exception != nil
    end

    # @param [Exception] exception
    def self.exception(exception)
      rv = Response.new
      rv.exception = exception
      rv
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monri-0.3.0 lib/monri/response.rb
monri-0.2.0 lib/monri/response.rb