Class: Madness::Navigation

Inherits:
Object
  • Object
show all
Includes:
ServerHelper
Defined in:
lib/madness/navigation.rb

Overview

Handle the navigation links for a given directory

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ServerHelper

#disallowed_static?, #docroot, #find_static_file, #log, #theme

Constructor Details

#initialize(dir) ⇒ Navigation

Returns a new instance of Navigation.



10
11
12
# File 'lib/madness/navigation.rb', line 10

def initialize(dir)
  @dir = dir
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



8
9
10
# File 'lib/madness/navigation.rb', line 8

def dir
  @dir
end

Instance Method Details

#captionObject



22
23
24
# File 'lib/madness/navigation.rb', line 22

def caption
  @caption ||= (dir == docroot ? 'Index' : File.basename(dir).to_label)
end


14
15
16
17
18
19
20
# File 'lib/madness/navigation.rb', line 14

def links
  @links ||= if config.sort_order == 'mixed'
    directory.list.nat_sort(by: :href)
  else
    directory.list
  end
end

#with_search?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/madness/navigation.rb', line 26

def with_search?
  true
end