Sha256: 5f657fc664ba0ab3dcebd4be1f5e79b037888c5a5f866d6191558367f6314485

Contents?: true

Size: 787 Bytes

Versions: 21

Compression:

Stored size: 787 Bytes

Contents

module Celluloid
  # Responses to calls
  class Response
    attr_reader :call, :value

    def initialize(call, value)
      @call, @value = call, value
    end

    def dispatch
      @call.task.resume self
    end
  end

  # Call completed successfully
  class SuccessResponse < Response; end

  # Call was aborted due to sender error
  class ErrorResponse < Response
    def value
      ex = super
      ex = ex.cause if ex.is_a? AbortError

      if ex.backtrace
        ex.backtrace << "(celluloid):0:in `remote procedure call'"
        ex.backtrace.concat(caller)
      end

      raise ex
    end
  end

  class BlockResponse
    def initialize(call, result)
      @call = call
      @result = result
    end

    def dispatch
      @call.task.resume(@result)
    end
  end

end

Version data entries

21 entries across 19 versions & 6 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/responses.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/celluloid-0.16.0/lib/celluloid/responses.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/responses.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/responses.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/celluloid-0.16.0/lib/celluloid/responses.rb
celluloid-0.16.0 lib/celluloid/responses.rb
celluloid-0.16.0.pre3 lib/celluloid/responses.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/responses.rb
celluloid-0.16.0.pre2 lib/celluloid/responses.rb
celluloid-0.16.0.pre lib/celluloid/responses.rb
celluloid-0.15.2 lib/celluloid/responses.rb
celluloid-0.15.1 lib/celluloid/responses.rb
celluloid-0.15.0 lib/celluloid/responses.rb
celluloid-0.15.0.pre2 lib/celluloid/responses.rb
celluloid-0.15.0.pre lib/celluloid/responses.rb
celluloid-0.14.1 lib/celluloid/responses.rb
celluloid-0.14.1.pre lib/celluloid/responses.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/celluloid-0.14.0/lib/celluloid/responses.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/celluloid-0.14.0/lib/celluloid/responses.rb
celluloid-0.14.0 lib/celluloid/responses.rb