Class: Mdextab::Table
- Inherits:
-
Object
- Object
- Mdextab::Table
- Extended by:
- Forwardable
- Defined in:
- lib/mdextab/table.rb
Overview
Tableクラス
Instance Attribute Summary collapse
-
#lineno ⇒ Object
readonly
入力Markdownファイル中のTABLEトークン出現行.
-
#tbody ⇒ Object
readonly
TABLE中のTBODYトークン出現行.
Instance Method Summary collapse
- #:@tbody ⇒ Object
- #add ⇒ Object
-
#add_tbody(lineno) ⇒ void
tbodyの追加.
- #add_td ⇒ Object
-
#initialize(lineno, mes, attr = nil) ⇒ Table
constructor
初期化.
-
#table_end ⇒ String
tableの終了処理.
-
#tbody_end ⇒ void
tbodyの終了処理.
- #td_append ⇒ Object
- #th_append ⇒ Object
-
#to_s(debug = false) ⇒ String
tableの文字列化.
Constructor Details
#initialize(lineno, mes, attr = nil) ⇒ Table
初期化
36 37 38 39 40 41 |
# File 'lib/mdextab/table.rb', line 36 def initialize(lineno, mes, attr=nil) @lineno = lineno @attr = attr @tbody = nil @mes = mes end |
Instance Attribute Details
#lineno ⇒ Object (readonly)
Returns 入力Markdownファイル中のTABLEトークン出現行.
25 26 27 |
# File 'lib/mdextab/table.rb', line 25 def lineno @lineno end |
#tbody ⇒ Object (readonly)
Returns TABLE中のTBODYトークン出現行.
28 29 30 |
# File 'lib/mdextab/table.rb', line 28 def tbody @tbody end |
Instance Method Details
#:@tbody ⇒ Object
20 |
# File 'lib/mdextab/table.rb', line 20 def_delegators :@tbody, :add_th, :add_td, :td_append, :th_append, :add |
#add ⇒ Object
20 |
# File 'lib/mdextab/table.rb', line 20 def_delegators :@tbody, :add_th, :add_td, :td_append, :th_append, :add |
#add_tbody(lineno) ⇒ void
This method returns an undefined value.
tbodyの追加
48 49 50 |
# File 'lib/mdextab/table.rb', line 48 def add_tbody(lineno) @tbody = Tbody.new(lineno, @mes) end |
#add_td ⇒ Object
20 |
# File 'lib/mdextab/table.rb', line 20 def_delegators :@tbody, :add_th, :add_td, :td_append, :th_append, :add |
#table_end ⇒ String
tableの終了処理
64 65 66 |
# File 'lib/mdextab/table.rb', line 64 def table_end to_s end |
#tbody_end ⇒ void
This method returns an undefined value.
tbodyの終了処理
56 57 58 |
# File 'lib/mdextab/table.rb', line 56 def tbody_end @tbody.finish end |
#td_append ⇒ Object
20 |
# File 'lib/mdextab/table.rb', line 20 def_delegators :@tbody, :add_th, :add_td, :td_append, :th_append, :add |
#th_append ⇒ Object
20 |
# File 'lib/mdextab/table.rb', line 20 def_delegators :@tbody, :add_th, :add_td, :td_append, :th_append, :add |
#to_s(debug = false) ⇒ String
tableの文字列化
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/mdextab/table.rb', line 73 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 |