Class: Mdextab::Table

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mdextab/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lineno, mes, attr = nil) ⇒ Table

Returns a new instance of Table.



9
10
11
12
13
14
# File 'lib/mdextab/table.rb', line 9

def initialize(lineno, mes, attr=nil)
  @lineno = lineno
  @attr = attr
  @tbody = nil
  @mes = mes
end

Instance Attribute Details

#linenoObject (readonly)

Returns the value of attribute lineno.



7
8
9
# File 'lib/mdextab/table.rb', line 7

def lineno
  @lineno
end

#tbodyObject (readonly)

Returns the value of attribute tbody.



7
8
9
# File 'lib/mdextab/table.rb', line 7

def tbody
  @tbody
end

Instance Method Details

#add_tbody(lineno) ⇒ Object



16
17
18
# File 'lib/mdextab/table.rb', line 16

def add_tbody(lineno)
  @tbody = Tbody.new(lineno, @mes)
end

#endObject



24
25
26
# File 'lib/mdextab/table.rb', line 24

def end
  table_end
end

#table_endObject



28
29
30
# File 'lib/mdextab/table.rb', line 28

def table_end
  to_s
end

#tbody_endObject



20
21
22
# File 'lib/mdextab/table.rb', line 20

def tbody_end
  @tbody.end
end

#to_s(debug = false) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mdextab/table.rb', line 32

def to_s(debug=false)
  if @attr
    if debug
      str = %Q(<table #{@attr} lineno:#{@lineno}>)
    else
      str = %Q(<table #{@attr}>)
    end
  elsif debug
    str = %Q(<table  lineno:#{@lineno}>)
  else
    str = %Q(<table>)
  end

  [str, @tbody.to_s, "</table>"].join("\n")
end