In Files

  • rdoc/markup/lines.rb

Parent

Included Modules

Files

Class/Module Index [+]

Quicksearch

RDoc::Markup::Lines

A container for all the lines.

Public Class Methods

new(lines) click to toggle source
 
               # File rdoc/markup/lines.rb, line 96
def initialize(lines)
  @lines = lines
  rewind
end
            

Public Instance Methods

as_text() click to toggle source
 
               # File rdoc/markup/lines.rb, line 141
def as_text
  @lines.map {|l| l.text}.join("\n")
end
            
delete(a_line) click to toggle source
 
               # File rdoc/markup/lines.rb, line 131
def delete(a_line)
  a_line.deleted = true
end
            
each() click to toggle source
 
               # File rdoc/markup/lines.rb, line 105
def each
  @lines.each do |line|
    yield line unless line.deleted
  end
end
            
empty?() click to toggle source
 
               # File rdoc/markup/lines.rb, line 101
def empty?
  @lines.size.zero?
end
            
line_types() click to toggle source
 
               # File rdoc/markup/lines.rb, line 145
def line_types
  @lines.map {|l| l.type }
end
            
next() click to toggle source
 
               # File rdoc/markup/lines.rb, line 119
def next
  begin
    res = @lines[@nextline]
    @nextline += 1 if @nextline < @lines.size
  end while res and res.deleted and @nextline < @lines.size
  res
end
            
normalize() click to toggle source
 
               # File rdoc/markup/lines.rb, line 135
def normalize
  margin = @lines.collect{|l| l.leading_spaces}.min
  margin = 0 if margin == :INFINITY
  @lines.each {|line| line.strip_leading(margin) } if margin > 0
end
            
rewind() click to toggle source

def [](index)

@lines[index]

end

 
               # File rdoc/markup/lines.rb, line 115
def rewind
  @nextline = 0
end
            
unget() click to toggle source
 
               # File rdoc/markup/lines.rb, line 127
def unget
  @nextline -= 1
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus