Class: Madness::Navigation
- Inherits:
-
Object
- Object
- Madness::Navigation
- Includes:
- ServerHelper
- Defined in:
- lib/madness/navigation.rb
Overview
Handle the navigation links for a given directory
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
- #caption ⇒ Object
-
#initialize(dir) ⇒ Navigation
constructor
A new instance of Navigation.
- #links ⇒ Object
- #with_search? ⇒ Boolean
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
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
8 9 10 |
# File 'lib/madness/navigation.rb', line 8 def dir @dir end |
Instance Method Details
#caption ⇒ Object
22 23 24 |
# File 'lib/madness/navigation.rb', line 22 def @caption ||= (dir == docroot ? 'Index' : File.basename(dir).to_label) end |
#links ⇒ Object
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
26 27 28 |
# File 'lib/madness/navigation.rb', line 26 def with_search? true end |