Class: NanDoc::Helpers::NanDocHelpers::TopNav
- Inherits:
-
Object
- Object
- NanDoc::Helpers::NanDocHelpers::TopNav
- Extended by:
- BlockAttrAccessor
- Defined in:
- lib/nandoc/helpers/top-nav.rb
Instance Attribute Summary collapse
-
#binding ⇒ Object
Returns the value of attribute binding.
Attributes included from BlockAttrAccessor
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&b) ⇒ TopNav
constructor
A new instance of TopNav.
- #render ⇒ Object
Methods included from BlockAttrAccessor
Constructor Details
#initialize(&b) ⇒ TopNav
Returns a new instance of TopNav.
26 27 28 29 30 |
# File 'lib/nandoc/helpers/top-nav.rb', line 26 def initialize(&b) block_attr_accessor_init @current_item = @items = @item = nil b.call(self) end |
Instance Attribute Details
#binding ⇒ Object
Returns the value of attribute binding.
32 33 34 |
# File 'lib/nandoc/helpers/top-nav.rb', line 32 def binding @binding end |
Class Method Details
.home_page(&b) ⇒ Object
42 43 44 |
# File 'lib/nandoc/helpers/top-nav.rb', line 42 def home_page &b @home_page ||= b.call end |
Instance Method Details
#render ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/nandoc/helpers/top-nav.rb', line 33 def render item = eval('@item', @binding) temdoz = [@current_item_proc.call(item)] while item = item.parent temdoz.concat [@separator_proc.call, @item_proc.call(item)] end temdoz.reverse end |