class PnoteClient::Documents::Hml::TableCell

Attributes

col_span[R]
paragraphs[R]
row_span[R]

Public Class Methods

from_tag(cell_tag) click to toggle source
# 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)

  pg_tags = cell_tag.xpath("PARALIST/P")
  pg_tags.each do |pg_tag|
    cell.add_paragraph(Paragraph.from_tag(pg_tag))
  end

  return cell
end
new(row_span: 1, col_span: 1) click to toggle source
# 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

Public Instance Methods

add_paragraph(new_paragraph) click to toggle source
# File lib/pnote_client/documents/hml/table_cell.rb, line 29
def add_paragraph(new_paragraph)
  @paragraphs << new_paragraph
end
content() click to toggle source
# 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

Private Instance Methods

paragraphs_content() click to toggle source
# File lib/pnote_client/documents/hml/table_cell.rb, line 43
def paragraphs_content
  return @paragraphs.map {|pg| pg.content}.join("\n")
end