ruby-xquery 0.1.1.270 → 0.2.0.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/Rakefile +5 -4
- data/lib/libxml/xquery.rb +3 -0
- data/lib/libxml/xquery/enhanced_find.rb +13 -17
- data/lib/libxml/xquery/{node.rb → string_representation.rb} +16 -0
- data/lib/libxml/xquery/{node_set.rb → uniqueness.rb} +17 -10
- data/lib/libxml/xquery/version.rb +2 -2
- metadata +19 -12
- data/lib/libxml/xquery/attr.rb +0 -33
- data/lib/libxml/xquery/xpath_object.rb +0 -45
data/README
CHANGED
data/Rakefile
CHANGED
@@ -12,9 +12,10 @@ Hen.lay! {{
|
|
12
12
|
},
|
13
13
|
|
14
14
|
:gem => {
|
15
|
-
:version
|
16
|
-
:summary
|
17
|
-
:files
|
18
|
-
:extra_files
|
15
|
+
:version => LibXML::XML::XQuery::VERSION,
|
16
|
+
:summary => "Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)",
|
17
|
+
:files => FileList['lib/**/*.rb'].to_a,
|
18
|
+
:extra_files => FileList['[A-Z]*', 'specs/*.rb', 'test_data/*'].to_a,
|
19
|
+
:dependencies => [['libxml-ruby', '>= 0.9.3']]
|
19
20
|
}
|
20
21
|
}}
|
data/lib/libxml/xquery.rb
CHANGED
@@ -24,26 +24,22 @@
|
|
24
24
|
###############################################################################
|
25
25
|
#++
|
26
26
|
|
27
|
-
module LibXML::XML::XQuery
|
27
|
+
module LibXML::XML::XQuery::EnhancedFind
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
alias_method :[], :enhanced_find
|
35
|
-
|
36
|
-
def /(xpath)
|
37
|
-
enhanced_find(xpath.to_s)
|
38
|
-
end
|
29
|
+
def enhanced_find(xpath)
|
30
|
+
find(xpath.gsub(/\*\*/, 'descendant::node()'), namespaces)
|
31
|
+
end
|
32
|
+
alias_method :[], :enhanced_find
|
39
33
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
base.send(:define_method, method, instance_method(method))
|
44
|
-
}
|
45
|
-
end
|
34
|
+
def /(xpath)
|
35
|
+
enhanced_find(xpath.to_s)
|
36
|
+
end
|
46
37
|
|
38
|
+
def self.included(base)
|
39
|
+
# overwrite original methods
|
40
|
+
instance_methods.each { |method|
|
41
|
+
base.send(:define_method, method, instance_method(method))
|
42
|
+
}
|
47
43
|
end
|
48
44
|
|
49
45
|
end
|
@@ -24,6 +24,14 @@
|
|
24
24
|
###############################################################################
|
25
25
|
#++
|
26
26
|
|
27
|
+
class LibXML::XML::Attr
|
28
|
+
|
29
|
+
def to_s(sep = nil)
|
30
|
+
value.strip
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
27
35
|
class LibXML::XML::Node
|
28
36
|
|
29
37
|
def to_s(sep = nil)
|
@@ -31,3 +39,11 @@ class LibXML::XML::Node
|
|
31
39
|
end
|
32
40
|
|
33
41
|
end
|
42
|
+
|
43
|
+
class LibXML::XML::XPath::Object
|
44
|
+
|
45
|
+
def to_s(sep = ' | ')
|
46
|
+
map { |n| (c = n.to_s(sep)).empty? ? nil : c }.compact.join(sep)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -26,13 +26,13 @@
|
|
26
26
|
|
27
27
|
require 'forwardable'
|
28
28
|
|
29
|
-
|
29
|
+
module LibXML::XML::XQuery::Uniqueness
|
30
30
|
|
31
31
|
extend Forwardable
|
32
32
|
|
33
|
-
|
33
|
+
DELEGATORS = %w[to_a each length size]
|
34
34
|
|
35
|
-
|
35
|
+
def_delegators *DELEGATORS
|
36
36
|
|
37
37
|
def to_a
|
38
38
|
if @_uniq
|
@@ -51,11 +51,11 @@ class LibXML::XML::Node::Set
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def uniq
|
54
|
-
proxy =
|
54
|
+
proxy = self.class.new.uniq!
|
55
55
|
proxy.instance_variable_set(:@_this, self)
|
56
56
|
|
57
57
|
class << proxy
|
58
|
-
(instance_methods -
|
58
|
+
(instance_methods - DELEGATORS).each { |method|
|
59
59
|
undef_method(method) unless method =~ /\A__/
|
60
60
|
}
|
61
61
|
|
@@ -76,12 +76,19 @@ class LibXML::XML::Node::Set
|
|
76
76
|
@_uniq
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
80
|
-
|
81
|
-
end
|
79
|
+
def self.included(base)
|
80
|
+
base.send(:alias_method, :_xquery_original_to_a, :to_a)
|
82
81
|
|
83
|
-
|
84
|
-
|
82
|
+
# overwrite original methods
|
83
|
+
instance_methods.each { |method|
|
84
|
+
base.send(:define_method, method, instance_method(method))
|
85
|
+
}
|
85
86
|
end
|
86
87
|
|
87
88
|
end
|
89
|
+
|
90
|
+
class LibXML::XML::XPath::Object
|
91
|
+
|
92
|
+
include LibXML::XML::XQuery::Uniqueness
|
93
|
+
|
94
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-xquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.296
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-24 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: libxml-ruby
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.3
|
24
|
+
version:
|
16
25
|
description: Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)
|
17
26
|
email: jens.wille@uni-koeln.de
|
18
27
|
executables: []
|
@@ -24,12 +33,10 @@ extra_rdoc_files:
|
|
24
33
|
- ChangeLog
|
25
34
|
- README
|
26
35
|
files:
|
27
|
-
- lib/libxml/xquery/
|
28
|
-
- lib/libxml/xquery/xpath_object.rb
|
29
|
-
- lib/libxml/xquery/attr.rb
|
36
|
+
- lib/libxml/xquery/uniqueness.rb
|
30
37
|
- lib/libxml/xquery/version.rb
|
38
|
+
- lib/libxml/xquery/string_representation.rb
|
31
39
|
- lib/libxml/xquery/enhanced_find.rb
|
32
|
-
- lib/libxml/xquery/node.rb
|
33
40
|
- lib/libxml/xquery.rb
|
34
41
|
- lib/xml/xquery.rb
|
35
42
|
- COPYING
|
@@ -43,14 +50,14 @@ homepage: http://prometheus.rubyforge.org/ruby-xquery
|
|
43
50
|
post_install_message:
|
44
51
|
rdoc_options:
|
45
52
|
- --line-numbers
|
53
|
+
- --main
|
54
|
+
- README
|
55
|
+
- --all
|
46
56
|
- --inline-source
|
47
57
|
- --title
|
48
58
|
- ruby-xquery Application documentation
|
49
59
|
- --charset
|
50
60
|
- UTF-8
|
51
|
-
- --main
|
52
|
-
- README
|
53
|
-
- --all
|
54
61
|
require_paths:
|
55
62
|
- lib
|
56
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -68,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
75
|
requirements: []
|
69
76
|
|
70
77
|
rubyforge_project: prometheus
|
71
|
-
rubygems_version: 1.
|
78
|
+
rubygems_version: 1.3.1
|
72
79
|
signing_key:
|
73
80
|
specification_version: 2
|
74
81
|
summary: Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)
|
data/lib/libxml/xquery/attr.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
###############################################################################
|
3
|
-
# #
|
4
|
-
# A component of ruby-xquery, mimicking XQuery in Ruby. #
|
5
|
-
# #
|
6
|
-
# Copyright (C) 2007-2008 Jens Wille #
|
7
|
-
# #
|
8
|
-
# Authors: #
|
9
|
-
# Jens Wille <jens.wille@uni-koeln.de> #
|
10
|
-
# #
|
11
|
-
# ruby-xquery is free software; you can redistribute it and/or modify it #
|
12
|
-
# under the terms of the GNU General Public License as published by the Free #
|
13
|
-
# Software Foundation; either version 3 of the License, or (at your option) #
|
14
|
-
# any later version. #
|
15
|
-
# #
|
16
|
-
# ruby-xquery is distributed in the hope that it will be useful, but WITHOUT #
|
17
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
19
|
-
# more details. #
|
20
|
-
# #
|
21
|
-
# You should have received a copy of the GNU General Public License along #
|
22
|
-
# with ruby-xquery. If not, see <http://www.gnu.org/licenses/>. #
|
23
|
-
# #
|
24
|
-
###############################################################################
|
25
|
-
#++
|
26
|
-
|
27
|
-
class LibXML::XML::Attr
|
28
|
-
|
29
|
-
def to_s(sep = nil)
|
30
|
-
value.strip
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
###############################################################################
|
3
|
-
# #
|
4
|
-
# A component of ruby-xquery, mimicking XQuery in Ruby. #
|
5
|
-
# #
|
6
|
-
# Copyright (C) 2007-2008 Jens Wille #
|
7
|
-
# #
|
8
|
-
# Authors: #
|
9
|
-
# Jens Wille <jens.wille@uni-koeln.de> #
|
10
|
-
# #
|
11
|
-
# ruby-xquery is free software; you can redistribute it and/or modify it #
|
12
|
-
# under the terms of the GNU General Public License as published by the Free #
|
13
|
-
# Software Foundation; either version 3 of the License, or (at your option) #
|
14
|
-
# any later version. #
|
15
|
-
# #
|
16
|
-
# ruby-xquery is distributed in the hope that it will be useful, but WITHOUT #
|
17
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
19
|
-
# more details. #
|
20
|
-
# #
|
21
|
-
# You should have received a copy of the GNU General Public License along #
|
22
|
-
# with ruby-xquery. If not, see <http://www.gnu.org/licenses/>. #
|
23
|
-
# #
|
24
|
-
###############################################################################
|
25
|
-
#++
|
26
|
-
|
27
|
-
require 'forwardable'
|
28
|
-
|
29
|
-
class LibXML::XML::XPath::Object
|
30
|
-
|
31
|
-
extend Forwardable
|
32
|
-
|
33
|
-
def_delegators :set, :to_a, :each, :length, :size, :uniq, :uniq!, :uniq?
|
34
|
-
|
35
|
-
alias_method :_xquery_original_set, :set
|
36
|
-
|
37
|
-
def set
|
38
|
-
@set ||= _xquery_original_set
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_s(sep = ' | ')
|
42
|
-
set.to_s(sep)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|