Class: Docs::C::EntriesFilter

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

Constant Summary collapse

ADDITIONAL_NAMES =
{
'Conditional inclusion' => %w(if else elif ifdef ifndef endif).map { |s| "##{s} directive" },
'Function specifiers' => ['inline specifier', '_Noreturn specifier'] }
REPLACE_NAMES =
{
'Error directive' => '#error directive',
'Filename and line information' => '#line directive',
'Implementation defined behavior control' => '#pragma directive',
'Replacing text macros' => '#define directive',
'Source file inclusion' => '#include directive',
'Warning directive' => '#warning directive' }

Constants inherited from Filter

Filter::SCHEME_RGX

Instance Method Summary collapse

Methods inherited from EntriesFilter

#build_entries, #build_entry, #call, #default_entry, #entries, #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


33
34
35
36
37
# File 'lib/docs/filters/c/entries.rb', line 33

def additional_entries
  names = at_css('#firstHeading').content.split(',')[1..-1]
  names.concat ADDITIONAL_NAMES[name] || []
  names.map { |name| [name] }
end

#get_nameObject


16
17
18
19
20
21
22
# File 'lib/docs/filters/c/entries.rb', line 16

def get_name
  name = at_css('#firstHeading').content.strip
  name.remove! 'C keywords: '
  name.remove! %r{\s\(.+\)}
  name = name.split(',').first
  REPLACE_NAMES[name] || name
end

#get_typeObject


24
25
26
27
28
29
30
31
# File 'lib/docs/filters/c/entries.rb', line 24

def get_type
  if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
    type.strip!
    type.remove! ' library'
    type.remove! ' utilities'
    type
  end
end

#include_default_entry?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/docs/filters/c/entries.rb', line 39

def include_default_entry?
  at_css '.t-navbar > div:nth-child(4) > a'
end