class PuzzleReader::DataSet

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/puzzle_reader.rb, line 15
def initialize(data)
  @data ||= []
  begin 
    current_row = data.next.strip!
    peek_row    = data.peek.strip
    return if current_row.nil?
  end while current_row.empty?

  if current_row =~ /^\d*$/
    rows = current_row.to_i.times
    if peek_row.empty?
      rows.each { @data << DataSet.new(data) } 
    else
      rows.each { @data << DataRow.new(data) }
    end
  end
end

Public Instance Methods

each(&block) click to toggle source
# File lib/puzzle_reader.rb, line 33
def each(&block)
  data.each(&block)
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/puzzle_reader.rb, line 37
def method_missing(m, *args, &block)
  begin
    @data.send(m, *args, &block)
  rescue NoMethodError
    super
  end
end
self() click to toggle source
# File lib/puzzle_reader.rb, line 11
def self
  @data
end