Sha256: 01ab8f214695ddf4f9cd06a8e3983b5f076ab6be6175bc8d24643247390ac4f1

Contents?: true

Size: 551 Bytes

Versions: 8

Compression:

Stored size: 551 Bytes

Contents

module RosettaQueue

  class Destinations
    
    @dest = {}

    class << self
      attr_reader :dest

      def define
        yield self
      end
      
      def clear
        @dest.clear
      end
      
      def lookup(dest_name)
        mapping = dest[dest_name.to_sym]
        raise "No destination mapping for '#{dest_name}' has been defined!" unless mapping
        return mapping
      end
      
      def map(key, dest)
        @dest[key] = dest
      end
      
      def queue_names
        @dest.values
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
bmabey-rosetta_queue-0.1.3 lib/rosetta_queue/destinations.rb
bmabey-rosetta_queue-0.2.0 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.1.4 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.2.0 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.2.1 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.2.2 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.3.0 lib/rosetta_queue/destinations.rb
cwyckoff-rosetta_queue-0.3.3 lib/rosetta_queue/destinations.rb