class Estratto::Register

Attributes

index[R]
line[R]
register_layout[R]

Public Class Methods

new(line, index, register_layout) click to toggle source
# File lib/estratto/register.rb, line 8
def initialize(line, index, register_layout)
  @line = line
  @index = index
  @register_layout = register_layout
end

Public Instance Methods

refine() click to toggle source
# File lib/estratto/register.rb, line 14
def refine
  register_layout.map do |layout|
    {
      layout['name'].to_sym => coerced_data(layout['range'], layout['type'], layout['formats'])
    }
  end.inject(&:merge)
end

Private Instance Methods

coerced_data(range, type, formats) click to toggle source
# File lib/estratto/register.rb, line 24
def coerced_data(range, type, formats)
  Estratto::Data::Coercer.new(
    index: index,
    data: line[Estratto::Helpers::Range.for(range)],
    type: type,
    formats: formats || {}
  ).build
end