Class: REXML::Parsers::BaseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/jrexml/ext/base_parser.rb

Overview

:nodoc:

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_parserObject

Set to true to disable JREXML (default nil/unset means use JREXML)



6
7
8
# File 'lib/jrexml/ext/base_parser.rb', line 6

def default_parser
  @default_parser
end

Class Method Details

.new(*args) ⇒ Object

Extend every REXML base parser with a version that uses a Java pull parser library



18
19
20
21
22
23
24
# File 'lib/jrexml/ext/base_parser.rb', line 18

def new(*args)
  obj = allocate
  obj.extend(JREXML::JavaPullParser) unless self.default_parser
  class << obj; public :initialize; end
  obj.initialize *args
  obj
end

.new_default_parser(*args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/jrexml/ext/base_parser.rb', line 8

def new_default_parser(*args)
  prev = self.default_parser
  self.default_parser = true
  new(*args)
ensure
  self.default_parser = prev
end