Module: Scripref::BasicMethods

Included in:
Parser, Processor
Defined in:
lib/scripref/basic_methods.rb

Overview

Mixin with methods of basic functionality

Constant Summary collapse

NUMBER_RE =
/\d+\s*/o

Instance Method Summary collapse

Instance Method Details

#book_reObject

Regular expression to match a book.



20
21
22
23
24
25
26
27
28
# File 'lib/scripref/basic_methods.rb', line 20

def book_re
  return @book_re if @book_re
  books_res_as_strings = book_names.map do |bn|
    bn.names.map do |n|
      (n.gsub(/([^\dA-Z])/, '\1?').gsub('.', '\.'))
    end
  end.flatten
  @book_re = Regexp.compile(books_res_as_strings.map {|s| '(\b' << s << '\b\.?\s*)' }.join('|'), nil)
end

#chapter_reObject

Regular expression to match a chapter



10
11
12
# File 'lib/scripref/basic_methods.rb', line 10

def chapter_re
  NUMBER_RE
end

#verse_reObject

Regular expression to match a verse



15
16
17
# File 'lib/scripref/basic_methods.rb', line 15

def verse_re
  NUMBER_RE
end