Class: Hamdown::MdRegs::AbstractReg

Inherits:
Object
  • Object
show all
Defined in:
lib/hamdown/md_regs/abstract_reg.rb

Overview

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

Direct Known Subclasses

Code, Fonts, Fonts2, Headers, Images, OList, Quotes, UList

Constant Summary collapse

REGS =
{}

Instance Method Summary collapse

Instance Method Details

#perform(text = '') ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/hamdown/md_regs/abstract_reg.rb', line 13

def perform(text = '')
  regs_arr.each do |reg|
    scan_res = text.scan(reg).to_a
    next if scan_res.size == 0

    text = text_handler(text, scan_res)
  end
  text
end