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.



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

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



12
13
14
# File 'lib/scripref/basic_methods.rb', line 12

def chapter_re
  NUMBER_RE
end

#verse_reObject

Regular expression to match a verse



17
18
19
# File 'lib/scripref/basic_methods.rb', line 17

def verse_re
  NUMBER_RE
end