lib/crossyglot/formats/jpz.rb
def parse_io(puzfile, options={})
        unzip_if_zip(puzfile) do |unzipped_puzfile|
          @xml = Nokogiri::XML(unzipped_puzfile.read) { |c| c.noblanks }
          @xml.remove_namespaces!
          @xml = @xml.at('rectangular-puzzle')

          raise NoRootJpzNode.new("Invalid .jpz XML, no root node found")  unless @xml

          if @xml
            @cword_elem = @xml.at('crossword')
            @grid_elem = @cword_elem.at('grid')

            parse_metadata
            parse_cells
            parse_clues
          end
        end

        update_word_lengths!

        self
      end
# Parses a puzzle from the IO object given
#
# @param [IO] puzfile A subclass of IO with the puzzle data
# @options [Hash] options See #parse_file options
# @returns self
Parses a puzzle from the IO object given
Parses a puzzle from the IO object given
def parse_io(puzfile, options={})
        unzip_if_zip(puzfile) do |unzipped_puzfile|
          @xml = Nokogiri::XML(unzipped_puzfile.read) { |c| c.noblanks }
          @xml.remove_namespaces!
          @xml = @xml.at('rectangular-puzzle')
          raise NoRootJpzNode.new("Invalid .jpz XML, no root node found")  unless @xml
          if @xml
            @cword_elem = @xml.at('crossword')
            @grid_elem = @cword_elem.at('grid')
            parse_metadata
            parse_cells
            parse_clues
          end
        end
        update_word_lengths!
        self
      end
def parse_io ( puzfile , options = { } ) unzip_if_zip ( puzfile ) do | unzipped_puzfile | @xml = Nokogiri :: XML ( unzipped_puzfile . read ) { | c | c . noblanks } @xml . remove_namespaces! @xml = @xml . at ( 'rectangular-puzzle' ) raise NoRootJpzNode . new ( "Invalid .jpz XML, no root node found" ) unless @xml if @xml @cword_elem = @xml . at ( 'crossword' ) @grid_elem = @cword_elem . at ( 'grid' ) parse_metadata parse_cells parse_clues end end update_word_lengths! self end
Parses a puzzle from the IO object given
Parses a puzzle from the IO object given
None
puzfile
options
puzfile A subclass of IO with the puzzle data
puzfile A subclass of IO with the puzzle data
options
[Hash] options See #parse_file options
[ Hash ] options See #parse_file options