class Estratto::Parser

Attributes

file_path[R]
layout[R]

Public Class Methods

new(file_path, layout) click to toggle source
# File lib/estratto/parser.rb, line 8
def initialize(file_path, layout)
  @file_path = file_path
  @layout = layout
end

Public Instance Methods

perform() click to toggle source
# File lib/estratto/parser.rb, line 13
def perform
  @data ||= raw_content.map.with_index do |line, index|
    register_layout = layout.register_fields_for(line[layout.prefix_range])
    next if register_layout.nil?
    Register.new(line, index, register_layout).refine
  end.compact
end
raw_content() click to toggle source
# File lib/estratto/parser.rb, line 21
def raw_content
  @raw_data = Content.for(file_path)
end