Class: Docs::Mongoose::EntriesFilter

Inherits:
EntriesFilter show all
Defined in:
lib/docs/filters/mongoose/entries.rb

Constant Summary

Constants inherited from Filter

Filter::SCHEME_RGX

Instance Method Summary collapse

Methods inherited from EntriesFilter

#build_entries, #build_entry, #call, #default_entry, #entries, #include_default_entry?, #name, #path, #type

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

#additional_entriesObject


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/docs/filters/mongoose/entries.rb', line 20

def additional_entries
  return [] unless slug == 'api'
  entries = []

  css('h3[id]').each do |node|
    next if node['id'] == 'index_'

    name = node.content.strip
    name.sub! %r{\(.+\)}, '()'
    next if name.include?(' ')

    type = name.split(/[#\.\(]/).first
    entries << [name, node['id'], type]
  end

  entries
end

#get_nameObject


4
5
6
7
8
9
10
# File 'lib/docs/filters/mongoose/entries.rb', line 4

def get_name
  if slug == 'api'
    'Mongoose'
  else
    at_css('h1').content
  end
end

#get_typeObject


12
13
14
15
16
17
18
# File 'lib/docs/filters/mongoose/entries.rb', line 12

def get_type
  if slug == 'api'
    'Mongoose'
  else
    'Guides'
  end
end