Class: EdifactConverter::FTXText
- Inherits:
-
Object
- Object
- EdifactConverter::FTXText
- Defined in:
- lib/edifact_converter/ftx_text.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#current_line ⇒ Object
readonly
Returns the value of attribute current_line.
Class Method Summary collapse
Instance Method Summary collapse
- #==(ftx_text) ⇒ Object
-
#initialize(ftxs) ⇒ FTXText
constructor
A new instance of FTXText.
- #lines ⇒ Object
Constructor Details
#initialize(ftxs) ⇒ FTXText
Returns a new instance of FTXText.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/edifact_converter/ftx_text.rb', line 56 def initialize(ftxs) ftxs.each do |ftx| font, format, align = extract_style ftx ftx.xpath('Elm[position() > 2]/SubElm/text()').each do |text| text = text.to_s continue_line = if text[-1] == '\\' text.chop! true end current_or_new_line(align).texts << Text.new(format, font, text) self.current_line = nil unless continue_line end end optimize_formatting pack_lines #lines.each { |line| puts line } end |
Instance Attribute Details
#current_line ⇒ Object
Returns the value of attribute current_line.
46 47 48 |
# File 'lib/edifact_converter/ftx_text.rb', line 46 def current_line @current_line end |
Class Method Details
.parse(ftxs) ⇒ Object
52 53 54 |
# File 'lib/edifact_converter/ftx_text.rb', line 52 def self.parse(ftxs) self.new ftxs end |
Instance Method Details
#==(ftx_text) ⇒ Object
74 75 76 |
# File 'lib/edifact_converter/ftx_text.rb', line 74 def ==(ftx_text) lines == ftx_text.lines end |
#lines ⇒ Object
48 49 50 |
# File 'lib/edifact_converter/ftx_text.rb', line 48 def lines @lines ||= [] end |