Class: TreeContext Private
- Inherits:
-
Object
- Object
- TreeContext
- 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
- #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
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
#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.
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 |
#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”
215 216 217 |
# File 'home_my_yard/templates/visualruby/fulldoc/html/setup.rb', line 215 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.
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 |