Class: NanDoc::Helpers::NanDocHelpers::MenuBouncy Private
- Inherits:
-
Object
- Object
- NanDoc::Helpers::NanDocHelpers::MenuBouncy
- Includes:
- StringMethods
- Defined in:
- lib/nandoc/helpers/menu-bouncy.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #separator_default ⇒ Object (also: #separator, #menu_item_bullet_right) private
- #tab ⇒ Object private
- #tabs ⇒ Object private
Instance Method Summary collapse
-
#initialize(binding, &block) ⇒ MenuBouncy
constructor
private
A new instance of MenuBouncy.
- #render ⇒ Object private
Methods included from StringMethods
#basename_no_extension, #indent, #no_blank_lines, #no_leading_ws, #no_trailing_ws, oxford_comma, #quoted, #reindent, #unindent
Constructor Details
#initialize(binding, &block) ⇒ MenuBouncy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MenuBouncy.
22 23 24 25 26 27 28 |
# File 'lib/nandoc/helpers/menu-bouncy.rb', line 22 def initialize(binding, &block) @separator_default = '>' @tab = ' ' @tabs = 0 @item = eval('@item', binding) block.call(self) end |
Instance Attribute Details
#separator_default ⇒ Object Also known as: separator,
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/nandoc/helpers/menu-bouncy.rb', line 29 def separator_default @separator_default end |
#tab ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/nandoc/helpers/menu-bouncy.rb', line 29 def tab @tab end |
#tabs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/nandoc/helpers/menu-bouncy.rb', line 29 def tabs @tabs end |
Instance Method Details
#render ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nandoc/helpers/menu-bouncy.rb', line 33 def render item = @item chunks = [] if item.nandoc_sorted_visible_children.any? chunks.push render_branch(item) else chunks.push render_leaf(item) end while item = item.parent chunks.push render_branch(item) end html = chunks.reverse.join('') html2 = reindent html html2.strip end |