Class: QuakeLogParser::KafkaTopicReader
- Inherits:
-
Object
- Object
- QuakeLogParser::KafkaTopicReader
- Defined in:
- lib/quake-log-parser/kafka_topic_reader.rb
Instance Method Summary collapse
-
#initialize(messages) ⇒ KafkaTopicReader
constructor
A new instance of KafkaTopicReader.
- #read ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(messages) ⇒ KafkaTopicReader
Returns a new instance of KafkaTopicReader.
3 4 5 6 |
# File 'lib/quake-log-parser/kafka_topic_reader.rb', line 3 def initialize() @messages = @line_handler = QuakeLogParser::LineHandler.new end |
Instance Method Details
#read ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/quake-log-parser/kafka_topic_reader.rb', line 8 def read @messages.each do || if .payload['lines'] .payload['lines'].each do |line| case line when QuakeLogParser::Patterns.new_game @line_handler.handle_new_game(line) when QuakeLogParser::Patterns.new_player @line_handler.handle_new_player(line) when QuakeLogParser::Patterns.new_kill @line_handler.handle_new_kill(line) end end end end end |
#results ⇒ Object
25 26 27 |
# File 'lib/quake-log-parser/kafka_topic_reader.rb', line 25 def results @line_handler.results end |