Class: Clarus::Paragraph

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

Constant Summary collapse

INDENT_CONSTANT =
540

Instance Method Summary collapse

Constructor Details

#initialize(indent = 0) ⇒ Paragraph

Returns a new instance of Paragraph.



5
6
7
8
9
# File 'lib/clarus/paragraph.rb', line 5

def initialize(indent = 0)
  @indent = INDENT_CONSTANT * indent
  @style = ""
  @items = []
end

Instance Method Details

#add_text(text, text_style = nil) ⇒ Object



11
12
13
# File 'lib/clarus/paragraph.rb', line 11

def add_text(text, text_style = nil)
  @items << TextBlock.new(text, text_style)
end

#renderObject



15
16
17
18
19
20
# File 'lib/clarus/paragraph.rb', line 15

def render
  document_template = File.read(File.expand_path('../templates/paragraph_fragment_template.erb', __FILE__))
  Erubis::Eruby.new(document_template).result(:style => @style,
                                              :items => @items,
                                              :indent => @indent)
end