def generate(debug = false)
      decorator = debug ? Fixy::Decorator::Debug : Fixy::Decorator::Default
      output = ''
      current_position = 1
      current_record = 1

      while current_position <= self.class.record_length do

        field = record_fields[current_position]
        raise StandardError, "Undefined field for position #{current_position}" unless field

        # We will first retrieve the value, then format it
        method          = field[:name]
        value           = send(method)
        formatted_value = format_value(value, field[:size], field[:type])
        formatted_value = decorator.field(formatted_value, current_record, current_position, method, field[:size], field[:type])

        output << formatted_value
        current_position = field[:to] + 1
        current_record += 1
      end

      # Documentation mandates that every record ends with new line.
      output << line_ending

      # All ready. In the words of Mr. Peters: "Take it and go!"
      decorator.record(output)
    end
def generate(debug = false)
      decorator = debug ? Fixy::Decorator::Debug : Fixy::Decorator::Default
      output = ''
      current_position = 1
      current_record = 1

      while current_position <= self.class.record_length do

        field = record_fields[current_position]
        raise StandardError, "Undefined field for position #{current_position}" unless field

        # We will first retrieve the value, then format it
        method          = field[:name]
        value           = send(method)
        formatted_value = format_value(value, field[:size], field[:type])
        formatted_value = decorator.field(formatted_value, current_record, current_position, method, field[:size], field[:type])

        output << formatted_value
        current_position = field[:to] + 1
        current_record += 1
      end

      # Documentation mandates that every record ends with new line.
      output << line_ending

      # All ready. In the words of Mr. Peters: "Take it and go!"
      decorator.record(output)
    end
Generate the entry based on the record structure