Sha256: 8d79d378125429a71d0a47550572b1198ad93eed43b8bbb6a8cde3ab44ff5533

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 Bytes

Contents

# encoding: utf-8

require 'adhearsion/error'

module Adhearsion
  ##
  # This exception may be raised if a transport error is detected.
  class ProtocolError < Error
    attr_accessor :name, :text, :call_id, :component_id

    def setup(name = nil, text = nil, call_id = nil, component_id = nil)
      @name, @text, @call_id, @component_id = name, text, call_id, component_id
      self
    end

    def to_s
      "#<#{self.class}: name=#{name.inspect} text=#{text.inspect} call_id=#{call_id.inspect} component_id=#{component_id.inspect}>"
    end
    alias :inspect :to_s

    def eql?(other)
      other.is_a?(self.class) && [:name, :text, :call_id, :component_id].all? { |f| self.__send__(f) == other.__send__(f) }
    end
    alias :== :eql?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-3.0.0.rc1 lib/adhearsion/protocol_error.rb
adhearsion-3.0.0.beta2 lib/adhearsion/protocol_error.rb
adhearsion-3.0.0.beta1 lib/adhearsion/protocol_error.rb