libxml-ext 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to libxml-ext version 0.3.2
5
+ This documentation refers to libxml-ext version 0.4.0
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -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
- if @_uniq
40
- # return unique nodes according to their #to_s
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
- _libxml_ext_original_to_a.each { |n|
45
- uniq << n unless seen[n.to_s]
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
- block_given? ? @_this.send(*args) { |a| yield a } : @_this.send(*args)
56
+ @_this.send(*args, &block_given? ? Proc.new : nil)
65
57
  end
66
58
  end
67
59
 
@@ -5,8 +5,8 @@ module LibXML
5
5
  module Version
6
6
 
7
7
  MAJOR = 0
8
- MINOR = 3
9
- TINY = 2
8
+ MINOR = 4
9
+ TINY = 0
10
10
 
11
11
  class << self
12
12
 
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: 23
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
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-24 00:00:00 +01:00
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