Module: ListParserUtils

Included in:
CurrentList, ListParser
Defined in:
lib/ribit/contentparser.rb

Overview

This module contains utility methods shared between several classes.

Instance Method Summary collapse

Instance Method Details

#build_regex(level) ⇒ Object

Builds regex for matching list item start depending from the level of the list. 1 is level for toplevel list.



408
409
410
411
412
413
414
415
# File 'lib/ribit/contentparser.rb', line 408

def build_regex( level )
  regex = '^'
  level = level * 2 + 1
  level.times { regex << ' ' }
  regex << '\* '
  
  return regex
end