Class | RDoc::Markup::Line |
In: |
markup/lines.rb
|
Parent: | Object |
We store the lines we‘re working on as objects of class Line. These contain the text of the line, along with a flag indicating the line type, and an indentation level.
# File markup/lines.rb, line 42 42: def initialize(text) 43: @text = text.dup 44: @deleted = false 45: 46: # expand tabs 47: 1 while @text.gsub!(/\t+/) { ' ' * (8*$&.length - $`.length % 8)} && $~ #` 48: 49: # Strip trailing whitespace 50: @text.sub!(/\s+$/, '') 51: 52: # and look for leading whitespace 53: if @text.length > 0 54: @text =~ /^(\s*)/ 55: @leading_spaces = $1.length 56: else 57: @leading_spaces = INFINITY 58: end 59: end
Return true if this line is blank
# File markup/lines.rb, line 62 62: def blank? 63: @text.empty? 64: end