Class: TreeContext Private
- Inherits:
-
Object
- Object
- TreeContext
- Defined in:
- lib/yard/to_mkdocs/default/fulldoc/html/setup.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.
Defined Under Namespace
Classes: Alternator
Instance Method Summary collapse
- #classes ⇒ Object private
-
#indent ⇒ String
private
Returns a css pixel offset, e.g.
-
#initialize ⇒ TreeContext
constructor
private
A new instance of TreeContext.
- #nest ⇒ Object private
Constructor Details
#initialize ⇒ TreeContext
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 TreeContext.
144 145 146 147 |
# File 'lib/yard/to_mkdocs/default/fulldoc/html/setup.rb', line 144 def initialize @depth = 0 @even_odd = Alternator.new(:even, :odd) end |
Instance Method Details
#classes ⇒ 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.
160 161 162 163 164 165 |
# File 'lib/yard/to_mkdocs/default/fulldoc/html/setup.rb', line 160 def classes classes = [] classes << 'collapsed' if @depth > 0 classes << @even_odd.next if @depth < 2 classes end |
#indent ⇒ String
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 css pixel offset, e.g. "30px"
156 157 158 |
# File 'lib/yard/to_mkdocs/default/fulldoc/html/setup.rb', line 156 def indent "#{(@depth + 2) * 15}px" end |
#nest ⇒ 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.
149 150 151 152 153 |
# File 'lib/yard/to_mkdocs/default/fulldoc/html/setup.rb', line 149 def nest @depth += 1 yield @depth -= 1 end |