Class: ReportBuilder::Builder::Text

Inherits:
ReportBuilder::Builder show all
Defined in:
lib/reportbuilder/builder/text.rb

Instance Attribute Summary collapse

Attributes inherited from ReportBuilder::Builder

#options, #parse_level

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReportBuilder::Builder

#default_options, #graph, #graph_entry, #image, #image_blob, #image_filename, inherited, inherited_classes, #parse_cycle, #parse_element, #save, #section, #table, #table_entry, #toc_entry

Constructor Details

#initialize(builder, options) ⇒ Text

Returns a new instance of Text.



6
7
8
9
# File 'lib/reportbuilder/builder/text.rb', line 6

def initialize(builder, options)
  super
  @out=""
end

Instance Attribute Details

#outObject (readonly)

Returns the value of attribute out.



5
6
7
# File 'lib/reportbuilder/builder/text.rb', line 5

def out
  @out
end

#tocObject (readonly)

Returns the value of attribute toc.



4
5
6
# File 'lib/reportbuilder/builder/text.rb', line 4

def toc
  @toc
end

Class Method Details

.codeObject



11
12
13
# File 'lib/reportbuilder/builder/text.rb', line 11

def self.code
  %w{text txt}
end

Instance Method Details

#html(t) ⇒ Object



29
30
31
# File 'lib/reportbuilder/builder/text.rb', line 29

def html(t)
  # Nothing printed
end

#new_pageObject



26
27
28
# File 'lib/reportbuilder/builder/text.rb', line 26

def new_page
  @out << "\n\n"
end

#parseObject



15
16
17
18
# File 'lib/reportbuilder/builder/text.rb', line 15

def parse
  @out="#{@builder.name}\n" unless @builder.no_title
  parse_cycle(@builder)
end

#preformatted(t) ⇒ Object



23
24
25
# File 'lib/reportbuilder/builder/text.rb', line 23

def preformatted(t)
  @out << t << "\n"
end

#text(t) ⇒ Object



19
20
21
22
# File 'lib/reportbuilder/builder/text.rb', line 19

def text(t)
  ws=" "*((parse_level-1)*2)
  @out << ws << t << "\n"
end