Class: Clarus::Paragraph
- Inherits:
-
Object
- Object
- Clarus::Paragraph
- Defined in:
- lib/clarus/paragraph.rb
Constant Summary collapse
- INDENT_CONSTANT =
540
Instance Method Summary collapse
- #add_text(text, text_style = nil) ⇒ Object
-
#initialize(indent = 0) ⇒ Paragraph
constructor
A new instance of Paragraph.
- #render ⇒ Object
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 |
#render ⇒ Object
15 16 17 18 19 20 |
# File 'lib/clarus/paragraph.rb', line 15 def render document_template = File.read(File.('../templates/paragraph_fragment_template.erb', __FILE__)) Erubis::Eruby.new(document_template).result(:style => @style, :items => @items, :indent => @indent) end |