ruby-xquery 0.2.0.296 → 0.2.1.297
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/lib/libxml/xquery/enhanced_find.rb +3 -32
- data/lib/libxml/xquery/namespaces.rb +67 -0
- data/lib/libxml/xquery/uniqueness.rb +3 -5
- data/lib/libxml/xquery/version.rb +1 -1
- metadata +7 -6
data/README
CHANGED
@@ -44,35 +44,6 @@ module LibXML::XML::XQuery::EnhancedFind
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
DEFAULT_NAMESPACES = []
|
52
|
-
|
53
|
-
# container for XML::Node's access to its document's namespaces
|
54
|
-
@namespaces = Hash.new(DEFAULT_NAMESPACES)
|
55
|
-
|
56
|
-
class << self; attr_reader :namespaces; end
|
57
|
-
|
58
|
-
def namespaces
|
59
|
-
@namespaces ||= DEFAULT_NAMESPACES
|
60
|
-
end
|
61
|
-
|
62
|
-
def namespaces=(ns)
|
63
|
-
raise "can't set namespaces (document has no URL)" unless url
|
64
|
-
|
65
|
-
@namespaces = self.class.namespaces[url] = ns
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
class LibXML::XML::Node
|
71
|
-
|
72
|
-
include LibXML::XML::XQuery::EnhancedFind
|
73
|
-
|
74
|
-
def namespaces
|
75
|
-
LibXML::XML::Document.namespaces[doc.url]
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
47
|
+
[LibXML::XML::Document, LibXML::XML::Node].each { |klass|
|
48
|
+
klass.send :include, LibXML::XML::XQuery::EnhancedFind
|
49
|
+
}
|
@@ -0,0 +1,67 @@
|
|
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
|
+
module LibXML::XML::XQuery::Namespaces
|
28
|
+
|
29
|
+
def namespaces
|
30
|
+
@namespaces ||= self.class::DEFAULT_NAMESPACES
|
31
|
+
end
|
32
|
+
|
33
|
+
def namespaces=(ns)
|
34
|
+
if url
|
35
|
+
@namespaces = self.class.namespaces[url] = ns
|
36
|
+
else
|
37
|
+
raise "can't set namespaces (document has no URL)"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.included(base)
|
42
|
+
base.const_set(:DEFAULT_NAMESPACES, [])
|
43
|
+
|
44
|
+
# container for XML::Node's access to its document's namespaces
|
45
|
+
base.instance_variable_set(
|
46
|
+
:@namespaces, Hash.new(base.const_get(:DEFAULT_NAMESPACES))
|
47
|
+
)
|
48
|
+
|
49
|
+
class << base; attr_reader :namespaces; end
|
50
|
+
|
51
|
+
# overwrite original methods
|
52
|
+
instance_methods.each { |method|
|
53
|
+
base.send(:define_method, method, instance_method(method))
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
[LibXML::XML::Document].each { |klass|
|
60
|
+
klass.send :include, LibXML::XML::XQuery::Namespaces
|
61
|
+
}
|
62
|
+
|
63
|
+
class LibXML::XML::Node
|
64
|
+
def namespaces
|
65
|
+
LibXML::XML::Document.namespaces[doc.url]
|
66
|
+
end
|
67
|
+
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.2.
|
4
|
+
version: 0.2.1.297
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-02 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,7 @@ extra_rdoc_files:
|
|
35
35
|
files:
|
36
36
|
- lib/libxml/xquery/uniqueness.rb
|
37
37
|
- lib/libxml/xquery/version.rb
|
38
|
+
- lib/libxml/xquery/namespaces.rb
|
38
39
|
- lib/libxml/xquery/string_representation.rb
|
39
40
|
- lib/libxml/xquery/enhanced_find.rb
|
40
41
|
- lib/libxml/xquery.rb
|
@@ -49,15 +50,15 @@ has_rdoc: true
|
|
49
50
|
homepage: http://prometheus.rubyforge.org/ruby-xquery
|
50
51
|
post_install_message:
|
51
52
|
rdoc_options:
|
52
|
-
- --line-numbers
|
53
|
-
- --main
|
54
|
-
- README
|
55
|
-
- --all
|
56
53
|
- --inline-source
|
57
54
|
- --title
|
58
55
|
- ruby-xquery Application documentation
|
59
56
|
- --charset
|
60
57
|
- UTF-8
|
58
|
+
- --main
|
59
|
+
- README
|
60
|
+
- --all
|
61
|
+
- --line-numbers
|
61
62
|
require_paths:
|
62
63
|
- lib
|
63
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|