Class: Coradoc::Element::Table::Row
- Defined in:
- lib/coradoc/element/table.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#header ⇒ Object
Returns the value of attribute header.
Instance Method Summary collapse
- #asciidoc? ⇒ Boolean
-
#initialize(columns, header = false) ⇒ Row
constructor
A new instance of Row.
- #table_header_row? ⇒ Boolean
- #to_adoc ⇒ Object
- #underline_for ⇒ Object
Methods inherited from Base
access_children, #children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(columns, header = false) ⇒ Row
Returns a new instance of Row.
30 31 32 33 |
# File 'lib/coradoc/element/table.rb', line 30 def initialize(columns, header = false) @columns = columns @header = header end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
26 27 28 |
# File 'lib/coradoc/element/table.rb', line 26 def columns @columns end |
#header ⇒ Object
Returns the value of attribute header.
26 27 28 |
# File 'lib/coradoc/element/table.rb', line 26 def header @header end |
Instance Method Details
#asciidoc? ⇒ Boolean
39 40 41 |
# File 'lib/coradoc/element/table.rb', line 39 def asciidoc? @columns.any? { |c| c.respond_to?(:asciidoc?) && c.asciidoc? } end |
#table_header_row? ⇒ Boolean
35 36 37 |
# File 'lib/coradoc/element/table.rb', line 35 def table_header_row? @header end |
#to_adoc ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/coradoc/element/table.rb', line 43 def to_adoc delim = asciidoc? ? "\n" : " " content = @columns.map do |col| Coradoc::Generator.gen_adoc(col) end.join(delim) result = "#{content}\n" result << "\n" if asciidoc? table_header_row? ? result + underline_for : result end |
#underline_for ⇒ Object
53 54 55 |
# File 'lib/coradoc/element/table.rb', line 53 def underline_for "\n" end |