Class: Datanorm::Lines::V4::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/datanorm/lines/v4/text.rb

Overview

Wraps a line of a DATANORM file that represents one line of a product description. Also known as Langtextsatz.

Instance Attribute Summary

Attributes inherited from Base

#columns, #source_line_number

Instance Method Summary collapse

Methods inherited from Base

#as_json, #encode, inherited, #initialize, #record_kind, #to_json

Constructor Details

This class inherits a constructor from Datanorm::Lines::Base

Instance Method Details

#<=>(other) ⇒ Object



25
26
27
# File 'lib/datanorm/lines/v4/text.rb', line 25

def <=>(other)
  line_number <=> other.line_number
end

#contentObject



21
22
23
# File 'lib/datanorm/lines/v4/text.rb', line 21

def content
  [columns[6], columns[9]].join("\n").strip
end

#idObject



13
14
15
# File 'lib/datanorm/lines/v4/text.rb', line 13

def id
  columns[2]
end

#line_numberObject



17
18
19
# File 'lib/datanorm/lines/v4/text.rb', line 17

def line_number
  columns[4].to_i
end

#to_sObject



9
10
11
# File 'lib/datanorm/lines/v4/text.rb', line 9

def to_s
  "TEXT [#{id}] <#{line_number}> #{content.encode('UTF-8', 'CP850').gsub("\n", '⏎')}"
end