Sha256: eabbaa5f3247b1d295ad5da45ef6de0c1b595fd7e55a34ea7ed5f7c035c38b0a

Contents?: true

Size: 482 Bytes

Versions: 4

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

module CottonTail
  module DSL
    # Topic DSL
    class Topic
      def initialize(routing_prefix, context)
        @routing_prefix = routing_prefix
        @context = context
      end

      def handle(routing_suffix, klass)
        key = routing_key(routing_suffix)
        @context.instance_eval { handle key, klass }
      end

      private

      def routing_key(suffix)
        [@routing_prefix, suffix].join('.')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cotton-tail-0.2.1 lib/cotton_tail/dsl/topic.rb
cotton-tail-0.2.0 lib/cotton_tail/dsl/topic.rb
cotton-tail-0.1.2 lib/cotton_tail/dsl/topic.rb
cotton-tail-0.1.1 lib/cotton_tail/dsl/topic.rb