Class: Docs::EntriesFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/docs/filters/core/entries.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

#additional_entriesObject


23
24
25
# File 'lib/docs/filters/core/entries.rb', line 23

def additional_entries
  []
end

#build_entries(entries) ⇒ Object


49
50
51
52
53
# File 'lib/docs/filters/core/entries.rb', line 49

def build_entries(entries)
  entries.map do |attributes|
    build_entry(*attributes)
  end
end

#build_entry(name, frag = nil, type = nil) ⇒ Object


55
56
57
58
# File 'lib/docs/filters/core/entries.rb', line 55

def build_entry(name, frag = nil, type = nil)
  type ||= self.type
  Entry.new name, frag ? "#{path}##{frag}" : path, type
end

#callObject


3
4
5
6
# File 'lib/docs/filters/core/entries.rb', line 3

def call
  result[:entries] = entries
  doc
end

#default_entryObject


19
20
21
# File 'lib/docs/filters/core/entries.rb', line 19

def default_entry
  [name]
end

#entriesObject


8
9
10
11
12
13
# File 'lib/docs/filters/core/entries.rb', line 8

def entries
  entries = []
  entries << default_entry if root_page? || include_default_entry?
  entries.concat(additional_entries)
  build_entries(entries)
end

#get_nameObject


32
33
34
# File 'lib/docs/filters/core/entries.rb', line 32

def get_name
  slug.to_s.gsub('_', ' ').gsub('/', '.').squish!
end

#get_typeObject


41
42
43
# File 'lib/docs/filters/core/entries.rb', line 41

def get_type
  nil
end

#include_default_entry?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'lib/docs/filters/core/entries.rb', line 15

def include_default_entry?
  true
end

#nameObject


27
28
29
30
# File 'lib/docs/filters/core/entries.rb', line 27

def name
  return @name if defined? @name
  @name = root_page? ? nil : get_name
end

#pathObject


45
46
47
# File 'lib/docs/filters/core/entries.rb', line 45

def path
  result[:path]
end

#typeObject


36
37
38
39
# File 'lib/docs/filters/core/entries.rb', line 36

def type
  return @type if defined? @type
  @type = root_page? ? nil : get_type
end