Class: Docs::Postgresql::ExtractMetadataFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/docs/filters/postgresql/extract_metadata.rb

Constant Summary

Constants inherited from Filter

Filter::SCHEME_RGX

Instance Method Summary collapse

Methods inherited from Filter

#absolute_url_string?, #at_css, #at_xpath, #base_url, #css, #current_url, #fragment_url_string?, #initial_page?, #parse_html, #relative_url_string?, #root_page?, #root_path, #root_url, #slug, #subpath, #subpath_to, #xpath

Instance Method Details

#callObject


4
5
6
7
8
# File 'lib/docs/filters/postgresql/extract_metadata.rb', line 4

def call
  extract_up_path
  extract_chapter
  doc
end

#extract_chapterObject


16
17
18
19
20
21
# File 'lib/docs/filters/postgresql/extract_metadata.rb', line 16

def extract_chapter
  return unless text = at_css('.NAVHEADER td[align="center"]').content
  return unless match = text.match(/\AChapter (\d+)\. (.+)\z/)
  result[:pg_chapter] = match[1].to_i
  result[:pg_chapter_name] = match[2]
end

#extract_up_pathObject


10
11
12
13
14
# File 'lib/docs/filters/postgresql/extract_metadata.rb', line 10

def extract_up_path
  if node = at_css('.NAVHEADER a[accesskey="U"]')
    result[:pg_up_path] = node['href']
  end
end