Sha256: 6ce024f0b47520a785d95d64328cf9cb1cf84249821bab2341d9e85e9e02274e

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require_relative 'base'

module Legion
  module Extensions
    module Helpers
      module Transport
        include Legion::Extensions::Helpers::Base

        def transport_path
          @transport_path ||= "#{full_path}/transport"
        end

        def transport_class
          @transport_class ||= lex_class::Transport
        end

        def messages
          @messages ||= transport_class::Messages
        end

        def queues
          @queues ||= transport_class::Queues
        end

        def exchanges
          @exchanges ||= transport_class::Exchanges
        end

        def default_exchange
          @default_exchange ||= build_default_exchange
        end

        def build_default_exchange
          exchange = "#{transport_class}::Exchanges::#{lex_const}"
          return Object.const_get(exchange) if transport_class::Exchanges.const_defined? lex_const

          transport_class::Exchanges.const_set(lex_const, Class.new(Legion::Transport::Exchange))
          @default_exchange = Kernel.const_get(exchange)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
legionio-0.2.0 lib/legion/extensions/helpers/transport.rb