Module: DebugServer::Parser

Included in:
Session
Defined in:
lib/debugserver/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_data(data) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/debugserver/parser.rb', line 3

def parse_data(data)
  packets = []
  data.strip.split("\n").each do |str|
    packets << parse_json(str.strip)
  end
  packets.select { |item| !item.nil? }
end

#parse_json(data) ⇒ Object



11
12
13
# File 'lib/debugserver/parser.rb', line 11

def parse_json(data)
  JSON.parse(data) rescue nil
end