libxml-ext 0.3.2 → 0.4.0
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/ext/default_prefix.rb +48 -0
- data/lib/libxml/ext/uniq_mixin.rb +5 -13
- data/lib/libxml/ext/version.rb +2 -2
- metadata +8 -7
data/README
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of libxml-ext, the LibXML extensions. #
|
5
|
+
# #
|
6
|
+
# Copyright (C) 2007-2011 Jens Wille #
|
7
|
+
# #
|
8
|
+
# Authors: #
|
9
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
10
|
+
# #
|
11
|
+
# libxml-ext 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
|
+
# libxml-ext 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 libxml-ext. If not, see <http://www.gnu.org/licenses/>. #
|
23
|
+
# #
|
24
|
+
###############################################################################
|
25
|
+
#++
|
26
|
+
|
27
|
+
require 'libxml'
|
28
|
+
|
29
|
+
module LibXML::XML
|
30
|
+
|
31
|
+
DEFAULT_PREFIX = 'ns'
|
32
|
+
|
33
|
+
class Parser
|
34
|
+
|
35
|
+
alias_method :_libxml_ext_original_parse, :parse
|
36
|
+
|
37
|
+
def parse(*args)
|
38
|
+
document = _libxml_ext_original_parse(*args)
|
39
|
+
|
40
|
+
ns = document.root.namespaces
|
41
|
+
ns.default_prefix = DEFAULT_PREFIX if ns.default
|
42
|
+
|
43
|
+
document
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -36,19 +36,11 @@ module LibXML
|
|
36
36
|
def_delegators *DELEGATORS
|
37
37
|
|
38
38
|
def to_a
|
39
|
-
|
40
|
-
|
41
|
-
seen = Hash.new { |h, k| h[k] = true; false }
|
42
|
-
uniq = []
|
39
|
+
ary = _libxml_ext_original_to_a
|
40
|
+
seen = Hash.new { |h, k| h[k] = true; false }
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
uniq
|
49
|
-
else
|
50
|
-
_libxml_ext_original_to_a
|
51
|
-
end
|
42
|
+
# return unique nodes according to their #to_s
|
43
|
+
@_uniq ? ary.delete_if { |node| seen[node.to_s] } : ary
|
52
44
|
end
|
53
45
|
|
54
46
|
def uniq
|
@@ -61,7 +53,7 @@ module LibXML
|
|
61
53
|
}
|
62
54
|
|
63
55
|
def method_missing(*args)
|
64
|
-
|
56
|
+
@_this.send(*args, &block_given? ? Proc.new : nil)
|
65
57
|
end
|
66
58
|
end
|
67
59
|
|
data/lib/libxml/ext/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libxml-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-25 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/libxml/ext/find_mixin.rb
|
51
51
|
- lib/libxml/ext/uniq_mixin.rb
|
52
52
|
- lib/libxml/ext/string.rb
|
53
|
+
- lib/libxml/ext/default_prefix.rb
|
53
54
|
- lib/libxml/ext/uniq.rb
|
54
55
|
- lib/libxml/ext.rb
|
55
56
|
- README
|
@@ -65,9 +66,9 @@ licenses: []
|
|
65
66
|
post_install_message:
|
66
67
|
rdoc_options:
|
67
68
|
- --line-numbers
|
68
|
-
- --inline-source
|
69
69
|
- --title
|
70
|
-
- libxml-ext Application documentation
|
70
|
+
- libxml-ext Application documentation (v0.4.0)
|
71
|
+
- --inline-source
|
71
72
|
- --main
|
72
73
|
- README
|
73
74
|
- --charset
|