Class: CodeBlock
- Inherits:
-
DocItem
- Object
- TextLineBuilderContext
- TextLine
- DocItem
- CodeBlock
- Defined in:
- lib/almirah/doc_items/code_block.rb
Instance Attribute Summary collapse
-
#code_lines ⇒ Object
Returns the value of attribute code_lines.
-
#suggested_format ⇒ Object
Returns the value of attribute suggested_format.
Attributes inherited from DocItem
Instance Method Summary collapse
-
#initialize(suggested_format) ⇒ CodeBlock
constructor
A new instance of CodeBlock.
- #to_html ⇒ Object
Methods inherited from DocItem
Methods inherited from TextLine
add_lazy_doc_id, #bold, #bold_and_italic, #format_string, #italic, #link
Methods inherited from TextLineBuilderContext
#bold, #bold_and_italic, #italic, #link
Constructor Details
#initialize(suggested_format) ⇒ CodeBlock
Returns a new instance of CodeBlock.
8 9 10 11 |
# File 'lib/almirah/doc_items/code_block.rb', line 8 def initialize(suggested_format) @suggested_format = suggested_format @code_lines = Array.new end |
Instance Attribute Details
#code_lines ⇒ Object
Returns the value of attribute code_lines.
6 7 8 |
# File 'lib/almirah/doc_items/code_block.rb', line 6 def code_lines @code_lines end |
#suggested_format ⇒ Object
Returns the value of attribute suggested_format.
5 6 7 |
# File 'lib/almirah/doc_items/code_block.rb', line 5 def suggested_format @suggested_format end |
Instance Method Details
#to_html ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/almirah/doc_items/code_block.rb', line 13 def to_html s = '' if @@html_table_render_in_progress s += "</table>\n" @@html_table_render_in_progress = false end s += "<code>" @code_lines.each do |l| s += l + " </br>" end s += "</code>\n" return s end |