Module: Parser

Defined in:
lib/harvester/parser.rb

Class Method Summary collapse

Class Method Details

.activate(topic, endpoint) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/harvester/parser.rb', line 8

def self.activate topic, endpoint
  puts topic, endpoint
  listener = EZMQ::Subscriber.new :connect, port: 5050, topic: topic, decode: -> m { Oj.load m }
  listener.listen do |message, topic|
    data = plow message, topic
    data.each do |item|
      puts @broadcaster.send item, topic: topic
    end
  end
end

.plow(message, parse) ⇒ Object



19
20
21
22
# File 'lib/harvester/parser.rb', line 19

def self.plow message, parse
  require_relative "../../parser_functions/#{parse}"
  send(parse, message)
end