File: get_response.rb

package info (click to toggle)
ruby-amqp 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,508 kB
  • sloc: ruby: 8,272; sh: 11; makefile: 10
file content (55 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# encoding: utf-8

# Purpose of this class is to simplify work with GetOk and GetEmpty.
module AMQ
  module Protocol
    class GetResponse
      attr_reader :method
      def initialize(method)
        @method = method
      end

      def empty?
        @method.is_a?(::AMQ::Protocol::Basic::GetEmpty)
      end

      # GetOk attributes
      def delivery_tag
        if @method.respond_to?(:delivery_tag)
          @method.delivery_tag
        end
      end

      def redelivered
        if @method.respond_to?(:redelivered)
          @method.redelivered
        end
      end

      def exchange
        if @method.respond_to?(:exchange)
          @method.exchange
        end
      end

      def routing_key
        if @method.respond_to?(:routing_key)
          @method.routing_key
        end
      end

      def message_count
        if @method.respond_to?(:message_count)
          @method.message_count
        end
      end

      # GetEmpty attributes
      def cluster_id
        if @method.respond_to?(:cluster_id)
          @method.cluster_id
        end
      end
    end
  end
end