class Parchment::TXT::Document

Public Class Methods

new(file) click to toggle source
# File lib/parchment/formats/txt/document.rb, line 9
def initialize(file)
  @text = file
  @styles = []
  set_paragraphs
end

Private Instance Methods

set_default_paragraph_style() click to toggle source
# File lib/parchment/formats/txt/document.rb, line 25
def set_default_paragraph_style
  @default_paragraph_style = Parchment::TXT::Style.new
end
set_paragraphs() click to toggle source

These methods parse and add the Document’s children and defaults.

# File lib/parchment/formats/txt/document.rb, line 19
def set_paragraphs
  set_default_paragraph_style
  # double quotes matter here
  @paragraphs = @text.gsub("\r", '').split("\n").map { |line| Parchment::TXT::Paragraph.new(line, self) }
end