From 4031c4f843230ca120b86bff0fb607e07645aa41 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 15 Jun 2015 23:44:54 +0200 Subject: [PATCH] Nuked Oga::XML::Lexer#html This method was rather pointless since there's already a "html?" method. --- ext/c/lexer.rl | 6 +++--- ext/java/org/liboga/xml/Lexer.rl | 2 +- lib/oga/xml/lexer.rb | 6 +----- lib/oga/xml/parser.rll | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/c/lexer.rl b/ext/c/lexer.rl index e952d6f..9d3ce1c 100644 --- a/ext/c/lexer.rl +++ b/ext/c/lexer.rl @@ -28,7 +28,7 @@ on `ts` and `te`) so the macro ignores this argument. ID id_advance_line; ID id_html_script_p; ID id_html_style_p; -ID id_html; +ID id_html_p; %%machine c_lexer; @@ -81,7 +81,7 @@ VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block) int lines; /* Whether or not HTML mode is enabled */ - int html_p = rb_funcall(self, id_html, 0) == Qtrue; + int html_p = rb_funcall(self, id_html_p, 0) == Qtrue; /* Make sure that all data passed back to Ruby has the proper encoding. */ rb_encoding *encoding = rb_enc_get(data_block); @@ -189,7 +189,7 @@ void Init_liboga_xml_lexer() id_advance_line = rb_intern("advance_line"); id_html_script_p = rb_intern("html_script?"); id_html_style_p = rb_intern("html_style?"); - id_html = rb_intern("html"); + id_html_p = rb_intern("html?"); rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 1); rb_define_method(cLexer, "reset_native", oga_xml_lexer_reset, 0); diff --git a/ext/java/org/liboga/xml/Lexer.rl b/ext/java/org/liboga/xml/Lexer.rl index 12d219d..1292cf6 100644 --- a/ext/java/org/liboga/xml/Lexer.rl +++ b/ext/java/org/liboga/xml/Lexer.rl @@ -89,7 +89,7 @@ public class Lexer extends RubyObject @JRubyMethod public IRubyObject advance_native(ThreadContext context, RubyString rb_str) { - Boolean html_p = this.callMethod(context, "html").isTrue(); + Boolean html_p = this.callMethod(context, "html?").isTrue(); Encoding encoding = rb_str.getEncoding(); diff --git a/lib/oga/xml/lexer.rb b/lib/oga/xml/lexer.rb index 45bc7ff..7354f5c 100644 --- a/lib/oga/xml/lexer.rb +++ b/lib/oga/xml/lexer.rb @@ -34,14 +34,10 @@ module Oga # However, it is perfectly save to use different instances per thread. # There is no _global_ state used by this lexer. # - # @!attribute [r] html - # @return [TrueClass|FalseClass] # # @private # class Lexer - attr_reader :html - # These are all constant/frozen to remove the need for String allocations # every time they are referenced in the lexer. HTML_SCRIPT = 'script'.freeze @@ -206,7 +202,7 @@ module Oga # @return [TrueClass|FalseClass] # def html? - return !!html + return @html == true end ## diff --git a/lib/oga/xml/parser.rll b/lib/oga/xml/parser.rll index c21f320..bf79942 100644 --- a/lib/oga/xml/parser.rll +++ b/lib/oga/xml/parser.rll @@ -310,7 +310,7 @@ string_body # @return [Oga::XML::Document] # def on_document(children = []) - document = Document.new(:type => @lexer.html ? :html : :xml) + document = Document.new(:type => @lexer.html? ? :html : :xml) children.each do |child| if child.is_a?(Doctype)