Class: TreeContext Private

Inherits:
Object
  • Object
show all
Defined in:
home_my_yard/templates/visualruby/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



203
204
205
206
# File 'home_my_yard/templates/visualruby/fulldoc/html/setup.rb', line 203

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.



219
220
221
222
223
224
# File 'home_my_yard/templates/visualruby/fulldoc/html/setup.rb', line 219

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”



215
216
217
# File 'home_my_yard/templates/visualruby/fulldoc/html/setup.rb', line 215

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.



208
209
210
211
212
# File 'home_my_yard/templates/visualruby/fulldoc/html/setup.rb', line 208

def nest
  @depth += 1
  yield
  @depth -= 1
end