Class: Rsssf::Patcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rsssf/patch.rb

Constant Summary collapse

SEASON =

e.g. 2008/09

note: also support 1999/2000
'\d{4}\/(\d{2}|\d{4})'

Instance Method Summary collapse

Instance Method Details

#patch_heading(txt, rxs, title) ⇒ Object

note: use single quotes - quotes do NOT get escaped (e.g. ‘d’ => “\d”)



11
12
13
14
15
16
17
18
19
20
# File 'lib/rsssf/patch.rb', line 11

def patch_heading( txt, rxs, title )
  rxs.each do |rx|
    txt = txt.sub( rx ) do |match|
      match = match.gsub( "\n", '$$')  ## change newlines to $$ for single-line outputs/dumps
      puts "  found heading >#{match}<"
      "\n\n#### #{title}\n\n"
    end
  end
  txt
end