class Hamdown::MdRegs::AbstractReg

Abstract class each child should consist logic how to recognize markdown's pattern and how to replace it to html it uses markdown gem

Constants

REGS

Public Instance Methods

perform(text = '') click to toggle source
   # File lib/hamdown/md_regs/abstract_reg.rb
13 def perform(text = '')
14   regs_arr.each do |reg|
15     scan_res = text.scan(reg).to_a
16     next if scan_res.size == 0
17 
18     text = text_handler(text, scan_res)
19   end
20   text
21 end

Private Instance Methods

md_to_html(text = '') click to toggle source
   # File lib/hamdown/md_regs/abstract_reg.rb
29 def md_to_html(text = '')
30   Markdown.new(text, banner: false).to_html
31 end
regs_arr() click to toggle source
   # File lib/hamdown/md_regs/abstract_reg.rb
33 def regs_arr
34   self.class::REGS.values
35 end
text_handler() click to toggle source
   # File lib/hamdown/md_regs/abstract_reg.rb
25 def text_handler
26   raise 'Does not implemented'
27 end