Class: Hikkoshi::Ghost::PostProcessor::TableDowngrader::Part

Inherits:
Object
  • Object
show all
Defined in:
lib/hikkoshi/ghost/post_processor/table_downgrader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_table:) ⇒ Part

Returns a new instance of Part.



38
39
40
41
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 38

def initialize(is_table:)
  @text = ""
  @is_table = is_table
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



36
37
38
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 36

def text
  @text
end

Instance Method Details

#<<(text) ⇒ Object



47
48
49
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 47

def <<(text)
  @text << text
end

#convert_table(text) ⇒ Object



60
61
62
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 60

def convert_table(text)
  CONVERTER.render(text)
end

#converted_textObject



51
52
53
54
55
56
57
58
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 51

def converted_text
  if self.table?
    # TODO: make this optional
    convert_table(@text) + "\n<!--\n#{@text}\n-->\n"
  else
    @text
  end
end

#table?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/hikkoshi/ghost/post_processor/table_downgrader.rb', line 43

def table?
  @is_table
end