Class: ROM::Kafka::Brokers
- Inherits:
-
Object
- Object
- ROM::Kafka::Brokers
- Defined in:
- lib/rom/kafka/brokers.rb,
lib/rom/kafka/brokers/broker.rb
Overview
Value object describing a collection of brokers (host:port)
Knows how to extract brokers from address lines and options
Defined Under Namespace
Classes: Broker
Instance Method Summary collapse
-
#initialize(lines, options) ⇒ Brokers
constructor
Initializes an immutable collection from address lines and/or options.
-
#to_a ⇒ Array<String>
Returns array of string representations of brokers.
Constructor Details
#initialize(lines, options) ⇒ Brokers
Initializes an immutable collection from address lines and/or options
The initializer is options-tolerant: it just ignores unknown options.
36 37 38 39 |
# File 'lib/rom/kafka/brokers.rb', line 36 def initialize(*lines) # @todo: refactor using factories hosts, port = extract_hosts_and_port(lines) @brokers = extract_brokers(hosts, port) end |
Instance Method Details
#to_a ⇒ Array<String>
Returns array of string representations of brokers
45 46 47 |
# File 'lib/rom/kafka/brokers.rb', line 45 def to_a @brokers.map(&:to_s) end |