Class: Clarus::TextBlock
- Inherits:
-
Object
- Object
- Clarus::TextBlock
- Defined in:
- lib/clarus/text_block.rb
Instance Method Summary collapse
-
#initialize(text, text_style) ⇒ TextBlock
constructor
A new instance of TextBlock.
- #render ⇒ Object
Constructor Details
#initialize(text, text_style) ⇒ TextBlock
Returns a new instance of TextBlock.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/clarus/text_block.rb', line 3 def initialize(text, text_style) @text = text if text_style == :bold @style = '<w:b/>\n' elsif text_style == :underline @style = '<w:u w:val="single"/>\n' elsif text_style == :italic @style = '<w:i/>\n' end end |
Instance Method Details
#render ⇒ Object
14 15 16 17 18 |
# File 'lib/clarus/text_block.rb', line 14 def render document_template = File.read(File.('../templates/text_block_template.erb', __FILE__)) Erubis::Eruby.new(document_template).result(:style => @style, :text => @text) end |