From 3a89dcffab11977ad1edfbb1b0b00eb7d4a8712e Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 9 Jul 2016 13:39:51 -0700 Subject: [PATCH] Remove Parser#reset and PullParser#reset --- lib/oga/xml/parser.rll | 16 ---------------- lib/oga/xml/pull_parser.rb | 6 +----- spec/oga/xml/pull_parser/general_spec.rb | 6 ------ 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/lib/oga/xml/parser.rll b/lib/oga/xml/parser.rll index 192e86a..7302005 100644 --- a/lib/oga/xml/parser.rll +++ b/lib/oga/xml/parser.rll @@ -237,14 +237,7 @@ string_body def initialize(data, options = {}) @data = data @lexer = Lexer.new(data, options) - - reset - end - - # Resets the internal state of the parser. - def reset @line = 1 - @lexer.reset_native end @@ -283,15 +276,6 @@ string_body raise LL::ParserError, message end - # @see [LL::Driver#parse] - def parse - retval = super - - reset - - retval - end - # @param [Array] children # @return [Oga::XML::Document] def on_document(children = []) diff --git a/lib/oga/xml/pull_parser.rb b/lib/oga/xml/pull_parser.rb index 37b5cf7..06c9ac7 100644 --- a/lib/oga/xml/pull_parser.rb +++ b/lib/oga/xml/pull_parser.rb @@ -54,13 +54,9 @@ module Oga :xml_declaration => XML::XmlDeclaration } - # @see Oga::XML::Parser#reset - def reset + def initialize(*args) super - - @block = nil @nesting = [] - @node = nil end # Parses the input and yields every node to the supplied block. diff --git a/spec/oga/xml/pull_parser/general_spec.rb b/spec/oga/xml/pull_parser/general_spec.rb index 94b207e..c8ccee7 100644 --- a/spec/oga/xml/pull_parser/general_spec.rb +++ b/spec/oga/xml/pull_parser/general_spec.rb @@ -11,11 +11,5 @@ describe Oga::XML::PullParser do @parser.node.is_a?(Oga::XML::Element).should == true end end - - it 'resets the current node after parsing' do - @parser.parse { } - - @parser.node.nil?.should == true - end end end