Class: PnoteClient::Documents::Hml::TableCell
- Inherits:
-
Object
- Object
- PnoteClient::Documents::Hml::TableCell
- Defined in:
- lib/pnote_client/documents/hml/table_cell.rb
Instance Attribute Summary collapse
-
#col_span ⇒ Object
readonly
Returns the value of attribute col_span.
-
#paragraphs ⇒ Object
readonly
Returns the value of attribute paragraphs.
-
#row_span ⇒ Object
readonly
Returns the value of attribute row_span.
Class Method Summary collapse
Instance Method Summary collapse
- #add_paragraph(new_paragraph) ⇒ Object
- #content ⇒ Object
-
#initialize(row_span: 1, col_span: 1) ⇒ TableCell
constructor
A new instance of TableCell.
Constructor Details
#initialize(row_span: 1, col_span: 1) ⇒ TableCell
Returns a new instance of TableCell.
23 24 25 26 27 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 23 def initialize(row_span: 1, col_span: 1) @row_span = row_span @col_span = col_span @paragraphs = [] end |
Instance Attribute Details
#col_span ⇒ Object (readonly)
Returns the value of attribute col_span.
21 22 23 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 21 def col_span @col_span end |
#paragraphs ⇒ Object (readonly)
Returns the value of attribute paragraphs.
21 22 23 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 21 def paragraphs @paragraphs end |
#row_span ⇒ Object (readonly)
Returns the value of attribute row_span.
21 22 23 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 21 def row_span @row_span end |
Class Method Details
.from_tag(cell_tag) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 7 def self.from_tag(cell_tag) row_span = cell_tag['RowSpan'] col_span = cell_tag['ColSpan'] cell = self.new(row_span: row_span.to_i, col_span: col_span.to_i) = cell_tag.xpath("PARALIST/P") .each do |pg_tag| cell.add_paragraph(Paragraph.from_tag(pg_tag)) end return cell end |
Instance Method Details
#add_paragraph(new_paragraph) ⇒ Object
29 30 31 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 29 def add_paragraph(new_paragraph) @paragraphs << new_paragraph end |
#content ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/pnote_client/documents/hml/table_cell.rb', line 33 def content return { row_span: @row_span, col_span: @col_span, content: paragraphs_content } end |