Class: Air::Parse::Stair
- Inherits:
-
Object
- Object
- Air::Parse::Stair
- Extended by:
- From
- Includes:
- Public
- Defined in:
- lib/air/parse.rb
Defined Under Namespace
Instance Attribute Summary
Attributes included from Public
Instance Method Summary collapse
-
#initialize(lines, at: 0) ⇒ Stair
constructor
A new instance of Stair.
Methods included from From
Methods included from Public
#leaf?, #line, #space_prefix, #stairs
Constructor Details
#initialize(lines, at: 0) ⇒ Stair
Returns a new instance of Stair.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/air/parse.rb', line 73 def initialize lines, at: 0 @start_at, @lines = at, lines next_index = at + 1 next_line = lines[next_index] if next_line && (next_line.space_prefix - space_prefix) == 2 until next_line.space_prefix <= space_prefix stair = Stair.from lines, at: next_index stairs << stair next_index = stair.end_at + 1 next_line = lines[next_index] break unless next_line end @end_at = stairs.last.end_at else @end_at = at end end |