Class: ControlledParagraph
- Defined in:
- lib/almirah/doc_items/controlled_paragraph.rb
Instance Attribute Summary collapse
-
#down_links ⇒ Object
Returns the value of attribute down_links.
-
#id ⇒ Object
Returns the value of attribute id.
-
#up_link ⇒ Object
Returns the value of attribute up_link.
Attributes inherited from Paragraph
Instance Method Summary collapse
-
#initialize(text, id) ⇒ ControlledParagraph
constructor
A new instance of ControlledParagraph.
- #to_html ⇒ Object
Methods inherited from Paragraph
Constructor Details
#initialize(text, id) ⇒ ControlledParagraph
9 10 11 12 13 14 |
# File 'lib/almirah/doc_items/controlled_paragraph.rb', line 9 def initialize(text, id) @text = text @id = id @up_link = nil @down_links = nil end |
Instance Attribute Details
#down_links ⇒ Object
Returns the value of attribute down_links.
7 8 9 |
# File 'lib/almirah/doc_items/controlled_paragraph.rb', line 7 def down_links @down_links end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/almirah/doc_items/controlled_paragraph.rb', line 5 def id @id end |
#up_link ⇒ Object
Returns the value of attribute up_link.
6 7 8 |
# File 'lib/almirah/doc_items/controlled_paragraph.rb', line 6 def up_link @up_link end |
Instance Method Details
#to_html ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/almirah/doc_items/controlled_paragraph.rb', line 16 def to_html s = '' unless @@htmlTableRenderInProgress s += "<table>\n\r" s += "\t<thead> <th>#</th> <th>Text</th> <th>UL</th> <th>DL</th> <th>COV</th> </thead>\n\r" @@htmlTableRenderInProgress = true end s += "\t<tr>\n\r" s += "\t\t<td> <a name=\"#{@id}\"></a>#{@id} </td>\n\r" s += "\t\t<td>#{@text}</td>\n\r" if @up_link if tmp = /^([a-zA-Z]+)[-]\d+/.match(@up_link) up_link_doc_name = tmp[1].downcase end s += "\t\t<td><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html\" class=\"external\">#{@up_link}</a></td>\n\r" else s += "\t\t<td></td>\n\r" end if @down_links if tmp = /^([a-zA-Z]+)[-]\d+/.match(@down_links[0].id) # guessing that all the links refer to one document down_link_doc_name = tmp[1].downcase end s += "\t\t<td><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html\" class=\"external\">#{@down_links.length}</a></td>\n\r" else s += "\t\t<td></td>\n\r" end #s += "\t\t<td></td>\n\r" # UL #s += "\t\t<td></td>\n\r" # DL s += "\t\t<td></td>\n\r" # COV s += "\t</tr>\n\r" return s end |