Parent

Included Modules

Class/Module Index [+]

Quicksearch

HTML5::TestSupport::TestData

Public Class Methods

new(filename, sections) click to toggle source
# File lib/feed_tools/vendor/html5/tests/preamble.rb, line 40
def initialize(filename, sections)
  @f = open(filename)
  @sections = sections
end

Public Instance Methods

each() click to toggle source
# File lib/feed_tools/vendor/html5/tests/preamble.rb, line 45
def each
  data = {}
  key = nil
  @f.each_line do |line|
    if line[0] == ## and @sections.include?(line[1..-2])
      heading = line[1..-2]
      if data.any? and heading == @sections[0]
        data[key].chomp!  #Remove trailing newline
        yield normaliseOutput(data)
        data = {}
      end
      key = heading
      data[key]=""
    elsif key
      data[key] += line
    end
  end
  yield normaliseOutput(data) if data
end
normaliseOutput(data) click to toggle source
# File lib/feed_tools/vendor/html5/tests/preamble.rb, line 65
def normaliseOutput(data)
  #Remove trailing newlines
  data.keys.each { |key| data[key].chomp! }
  @sections.map {|heading| data[heading]}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.