Sha256: 9d1e481122f48b1cccdcad697aeb806da9138d204c0e21e6872c04f4348a74a4

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 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

1 entries across 1 versions & 1 rubygems

Version Path
bmabey-rosetta_queue-0.3.3 lib/rosetta_queue/destinations.rb