Class: Rsirts::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/rsirts/parser.rb

Constant Summary collapse

ZMAP_VALUES =
Hash[ "12345689-".each_char.to_a.map { |v| [v, v == '-' ? 0 : v.to_i]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(path) ⇒ Object



9
10
11
# File 'lib/rsirts/parser.rb', line 9

def self.parse path
  new.parse path
end

Instance Method Details

#parse(path) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rsirts/parser.rb', line 13

def parse path
  map_depth(
    File.new(path)
    .readlines
    .map { |line| line.chomp }
    .tap { |lines| check_format lines }
  )
end