Class: GPLType::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/curses_color.rb

Overview

Text to type

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Text

Returns a new instance of Text.



212
213
214
215
# File 'lib/curses_color.rb', line 212

def initialize(str)
  @lines = str.split("\n").unshift("")
  @sections = []
end

Instance Method Details

#define_section(subject_ln, body_range, high_sec = 9999, high_chars = 0) ⇒ Object



217
218
219
220
221
222
223
224
# File 'lib/curses_color.rb', line 217

def define_section(subject_ln, body_range, high_sec = 9999, high_chars = 0)
  subject = @lines[subject_ln].strip
  body_lines = @lines[body_range]
  body_lines.map!{ |line| line.rstrip.gsub(/\s+/){" "} }
  body_lines = body_lines.delete_if{ |line| line.empty? }

  @sections.push(Section.new(subject, body_lines, high_sec, high_chars))
end

#sectionsObject



226
227
228
# File 'lib/curses_color.rb', line 226

def sections
  @sections
end