Class: Coradoc::Element::Table::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/element/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Cell

Returns a new instance of Cell.



49
50
51
52
53
54
55
56
57
# File 'lib/coradoc/element/table.rb', line 49

def initialize(options = {})
  @id = options.fetch(:id, nil)
  @anchor = @id.nil? ? nil : Inline::Anchor.new(@id)
  @colrowattr = options.fetch(:colrowattr, '')
  @alignattr = options.fetch(:alignattr, '')
  @style = options.fetch(:style, '')
  @content = options.fetch(:content, '')
  @delim = options.fetch(:delim, '')
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



48
49
50
# File 'lib/coradoc/element/table.rb', line 48

def anchor
  @anchor
end

Instance Method Details

#to_adocObject



59
60
61
62
63
# File 'lib/coradoc/element/table.rb', line 59

def to_adoc
  anchor = @anchor.nil? ? "" : "#{@anchor.to_adoc}"
  content = Coradoc::Generator.gen_adoc(@content)
  "#{@colrowattr}#{@alignattr}#{@style}| #{anchor}#{content}#{@delim}"
end