Sha256: 7c3383736e498606d5568eb24f3c112841a16f466d6d68b5511447ff7199bc64

Contents?: true

Size: 1.96 KB

Versions: 11

Compression:

Stored size: 1.96 KB

Contents

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

module Qpid

  module Proton

    # TrackerStatus contains symbols that represent the status value for a
    # Tracker.
    #
    class TrackerStatus

        def initialize value, name # :nodoc:
          @value = value
          @name = name
        end

        def value # :nodoc:
          @value
        end

        def to_s # :nodoc:
          @name.to_s
        end

       def self.by_name(name) # :nodoc:
          @by_name[name.to_sym] unless name.nil?
        end

        def self.by_value(value) # :nodoc:
          @by_value[value] unless value.nil?
        end

        private

        def self.add_item(key, value) # :nodoc:
          @by_name ||= {}
          @by_name[key] = TrackerStatus.new value, key
          @by_value ||= {}
          @by_value[value] = @by_name[key]
        end

        def self.const_missing(key) # :nodoc:
          @by_name[key]
        end

        self.add_item :UNKNOWN,  Cproton::PN_STATUS_UNKNOWN
        self.add_item :PENDING,  Cproton::PN_STATUS_PENDING
        self.add_item :ACCEPTED, Cproton::PN_STATUS_ACCEPTED
        self.add_item :REJECTED, Cproton::PN_STATUS_REJECTED
        self.add_item :SETTLED,  Cproton::PN_STATUS_SETTLED

    end

  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mqlight-1.0.2015020300.beta-x86_64-darwin-15 lib/qpid_proton/tracker_status.rb
mqlight-1.0.2015020300.beta-x86_64-linux lib/qpid_proton/tracker_status.rb
mqlight-1.0.2015020300.beta-x86_64-darwin-13 lib/qpid_proton/tracker_status.rb
mqlight-1.0.2014120914.beta-x86_64-darwin-13 lib/qpid_proton/tracker_status.rb
mqlight-1.0.2014120914.beta-x86_64-linux lib/qpid_proton/tracker_status.rb
mqlight-1.0.2014120516.beta-x86_64-linux lib/qpid_proton/tracker_status.rb
mqlight-1.0.2014120423.beta-x86_64-linux lib/qpid_proton/tracker_status.rb
qpid_proton-0.8 lib/qpid_proton/tracker_status.rb
qpid_proton-0.7.1 lib/qpid_proton/tracker_status.rb
qpid_proton-0.7 lib/qpid_proton/tracker_status.rb
qpid_proton-0.6 lib/qpid_proton/tracker_status.rb