# File lib/mizuho/utils.rb, line 47 def chapter_to_int_array(chapter) return chapter.split('.').map { |x| x.to_i } end
Given a title with a chapter number, e.g. "6.1 Installation using tarball", splits the two up.
# File lib/mizuho/utils.rb, line 36 def extract_chapter(title) title =~ /^((\d+\.)*) (.+)$/ chapter = $1 pure_title = $3 if !chapter.nil? && !chapter.empty? && pure_title && !pure_title.empty? return [chapter, pure_title] else return nil end end
# File lib/mizuho/utils.rb, line 51 def title_to_docid(title) chapter, pure_title = extract_chapter(title) p title numbers = chapter_to_int_array(chapter) result = 0 bit_offset = 0 numbers.each do |num| result = result | (num << bit_offset) bit_offset += 5 end return result end
Generated with the Darkfish Rdoc Generator 2.