Class: Karafka::Connection::Mode
- Inherits:
-
Object
- Object
- Karafka::Connection::Mode
- Defined in:
- lib/karafka/connection/mode.rb
Overview
Note:
This class is used internally by the Client and is not part of the public API
Represents the connection mode state of the Kafka client. Encapsulates mode logic and provides a cleaner API for checking and setting connection modes, removing the need for symbol comparisons throughout the connection management code.
Instance Method Summary collapse
-
#initialize(mode = :subscribe) ⇒ Mode
constructor
A new instance of Mode.
-
#to_s ⇒ String
String representation of the current mode.
-
#to_sym ⇒ Symbol
Symbol representation of the current mode.
Constructor Details
#initialize(mode = :subscribe) ⇒ Mode
Returns a new instance of Mode.
29 30 31 |
# File 'lib/karafka/connection/mode.rb', line 29 def initialize(mode = :subscribe) self.mode = mode end |
Instance Method Details
#to_s ⇒ String
Returns string representation of the current mode.
50 51 52 |
# File 'lib/karafka/connection/mode.rb', line 50 def to_s @mode.to_s end |
#to_sym ⇒ Symbol
Returns symbol representation of the current mode.
55 56 57 |
# File 'lib/karafka/connection/mode.rb', line 55 def to_sym @mode end |