Class: TreeContext Private

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeTreeContext

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

#classesObject

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

#indentString

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"

Returns:

  • (String)

    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

#nestObject

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