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
Constructor Details
#initialize(dir) ⇒ Navigation
Returns a new instance of Navigation.
9 10 11 |
# File 'lib/madness/navigation.rb', line 9 def initialize(dir) @dir = dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
7 8 9 |
# File 'lib/madness/navigation.rb', line 7 def dir @dir end |
Instance Method Details
#caption ⇒ Object
17 18 19 |
# File 'lib/madness/navigation.rb', line 17 def @caption ||= (dir == docroot ? "Index" : File.basename(dir).to_label) end |
#links ⇒ Object
13 14 15 |
# File 'lib/madness/navigation.rb', line 13 def links @links ||= directory.list end |
#with_search? ⇒ Boolean
21 22 23 |
# File 'lib/madness/navigation.rb', line 21 def with_search? @with_search ||= Search.new.has_index? end |