Class: REXML::XPath

Inherits:
Object
  • Object
show all
Defined in:
lib/feed_tools/monkey_patch.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.liberal_each(element, path = nil, namespaces = {}, variables = {}, &block) ⇒ Object



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/feed_tools/monkey_patch.rb', line 606

def self.liberal_each(element, path=nil, namespaces={},
    variables={}, &block) # :nodoc:
			parser = LiberalXPathParser.new
			parser.namespaces = namespaces
			parser.variables = variables
			path = "*" unless path
			element = [element] unless element.kind_of? Array
			retried = false
			begin
	parser.parse(path, element).each( &block )
rescue NoMethodError => error
  retry if !retried
  raise error
end
end

.liberal_first(element, path = nil, namespaces = {}, variables = {}) ⇒ Object



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/feed_tools/monkey_patch.rb', line 590

def self.liberal_first(element, path=nil, namespaces={},
    variables={}) # :nodoc:
  parser = LiberalXPathParser.new
  parser.namespaces = namespaces
  parser.variables = variables
  path = "*" unless path
  element = [element] unless element.kind_of? Array
			retried = false
			begin
    parser.parse(path, element)[0]
rescue NoMethodError => error
  retry if !retried
  raise error
end
end

.liberal_match(element, path = nil, namespaces = {}, variables = {}) ⇒ Object



574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/feed_tools/monkey_patch.rb', line 574

def self.liberal_match(element, path=nil, namespaces={},
    variables={}) # :nodoc:
			parser = LiberalXPathParser.new
			parser.namespaces = namespaces
			parser.variables = variables
			path = "*" unless path
			element = [element] unless element.kind_of? Array
			retried = false
			begin
	parser.parse(path, element)
rescue NoMethodError => error
  retry if !retried
  raise error
end
end