Sha256: ed5662f4659149d415a0f803810c32de614efbd6d7a6b1d456431eb5b489b584

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 Bytes

Contents

# encoding: utf-8

module Punchblock
  ##
  # This exception may be raised if a transport error is detected.
  class ProtocolError < StandardError
    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

2 entries across 2 versions & 1 rubygems

Version Path
punchblock-0.12.0 lib/punchblock/protocol_error.rb
punchblock-0.11.0 lib/punchblock/protocol_error.rb