Sha256: 03d93a65f46f99ba8f4e9b41f94a08ec1afca98d66d922e133170cc8973baf96

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

module Aggro
  # Public: Represents the local aggro server node.
  class LocalNode < Struct.new(:id)
    def client
      @client ||= create_loopback_client
    end

    def endpoint
      "tcp://*:#{Aggro.port}"
    end

    def publisher_endpoint
      "tcp://*:#{Aggro.publisher_port}"
    end

    def to_s
      id
    end

    private

    def create_loopback_client
      ->(msg) { Aggro.server.handle_message msg }.tap do |proc|
        proc.class_eval { alias_method :post, :call }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aggro-0.0.4 lib/aggro/local_node.rb
aggro-0.0.3 lib/aggro/local_node.rb