Module: LibXML::XML::XQuery::EnhancedFind

Defined in:
lib/libxml/xquery/enhanced_find.rb

Overview

#

A component of ruby-xquery, mimicking XQuery in Ruby. #

#

Copyright © 2007-2008 Jens Wille #

#

Authors: #

Jens Wille <[email protected]>                                    #
                                                                        #

ruby-xquery is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) # any later version. #

#

ruby-xquery is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. #

#

You should have received a copy of the GNU General Public License along # with ruby-xquery. If not, see <www.gnu.org/licenses/>. #

#

++

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



38
39
40
41
42
43
# File 'lib/libxml/xquery/enhanced_find.rb', line 38

def self.included(base)
  # overwrite original methods
  instance_methods.each { |method|
    base.send(:define_method, method, instance_method(method))
  }
end

Instance Method Details

#/(xpath) ⇒ Object



34
35
36
# File 'lib/libxml/xquery/enhanced_find.rb', line 34

def /(xpath)
  enhanced_find(xpath.to_s)
end

#enhanced_find(xpath) ⇒ Object Also known as: []



29
30
31
# File 'lib/libxml/xquery/enhanced_find.rb', line 29

def enhanced_find(xpath)
  find(xpath.gsub(/\*\*/, 'descendant::node()'), namespaces)
end