Class: ROM::Kafka::Brokers::Broker
- Inherits:
-
Object
- Object
- ROM::Kafka::Brokers::Broker
- Defined in:
- lib/rom/kafka/brokers/broker.rb
Overview
Describes an address to a brocker
Constant Summary collapse
- HOST =
Regex to extract host from address line
%r{^\w+(\:\/\/)?\S+(?=\:)|\S+}.freeze
- PORT =
Regex to extract port from address line
/(?!\:)\d{4,5}$/.freeze
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
The host of the broker.
-
#port ⇒ Integer
readonly
The port of the broker.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Broker
constructor
Initializes a value object from host line and port.
-
#to_s ⇒ String
Returns the string representation of the broker in “host:port” format.
Constructor Details
Instance Attribute Details
#host ⇒ String (readonly)
Returns the host of the broker.
30 31 32 |
# File 'lib/rom/kafka/brokers/broker.rb', line 30 def host @host end |
#port ⇒ Integer (readonly)
Returns the port of the broker.
36 37 38 |
# File 'lib/rom/kafka/brokers/broker.rb', line 36 def port @port end |
Instance Method Details
#to_s ⇒ String
Returns the string representation of the broker in “host:port” format
53 54 55 |
# File 'lib/rom/kafka/brokers/broker.rb', line 53 def to_s "#{host}:#{port}" end |