Class: Mdextab::Td
- Inherits:
-
Object
- Object
- Mdextab::Td
- Defined in:
- lib/mdextab/td.rb
Overview
TDトークン対応クラス
Instance Method Summary collapse
-
#add(content, condnese) ⇒ void
TDトークンのコンテンツ追加.
-
#initialize(lineno, attr = nil) ⇒ Td
constructor
初期化.
-
#to_s ⇒ String
tdの文字列化.
Constructor Details
#initialize(lineno, attr = nil) ⇒ Td
初期化
10 11 12 13 14 |
# File 'lib/mdextab/td.rb', line 10 def initialize(lineno, attr=nil) @lineno = lineno @attr = attr @content = "" end |
Instance Method Details
#add(content, condnese) ⇒ void
This method returns an undefined value.
TDトークンのコンテンツ追加
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mdextab/td.rb', line 22 def add(content, condnese) if condnese if @content if @contnet.match?(/^\s*$/) @content = content.to_s else @content += content.to_s end else @content = content.to_s end elsif content @content = [@content, content].join("\n") end end |
#to_s ⇒ String
tdの文字列化
42 43 44 45 46 47 48 |
# File 'lib/mdextab/td.rb', line 42 def to_s if @attr.nil? %Q(<td>#{@content}</td>) else %Q(<td #{@attr}>#{@content}</td>) end end |