multi_xml 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of multi_xml might be problematic. Click here for more details.
- data/.autotest +1 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -1
- data/Gemfile +3 -3
- data/{LICENSE.mkd → LICENSE.md} +0 -0
- data/{README.mkd → README.md} +37 -7
- data/Rakefile +3 -1
- data/lib/multi_xml.rb +53 -44
- data/lib/multi_xml/parsers/libxml.rb +13 -62
- data/lib/multi_xml/parsers/libxml2_parser.rb +66 -0
- data/lib/multi_xml/parsers/nokogiri.rb +16 -63
- data/lib/multi_xml/parsers/rexml.rb +8 -20
- data/lib/multi_xml/version.rb +1 -1
- data/multi_xml.gemspec +20 -22
- data/spec/helper.rb +0 -1
- data/spec/multi_xml_spec.rb +14 -551
- data/spec/parser_shared_example.rb +550 -0
- metadata +80 -94
- data/lib/multi_xml/core_extensions.rb +0 -108
metadata
CHANGED
@@ -1,161 +1,147 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_xml
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Erik Michaels-Ober
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-03-20 00:00:00 -07:00
|
12
|
+
date: 2011-08-08 00:00:00.000000000 -07:00
|
14
13
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ZenTest
|
17
|
+
requirement: &70225559600760 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
19
|
+
requirements:
|
22
20
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.5'
|
25
23
|
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: maruku
|
29
24
|
prerelease: false
|
30
|
-
|
25
|
+
version_requirements: *70225559600760
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: maruku
|
28
|
+
requirement: &70225559600260 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
30
|
+
requirements:
|
33
31
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
36
34
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: nokogiri
|
40
35
|
prerelease: false
|
41
|
-
|
36
|
+
version_requirements: *70225559600260
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: nokogiri
|
39
|
+
requirement: &70225559599800 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
|
-
requirements:
|
41
|
+
requirements:
|
44
42
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '1.4'
|
47
45
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rake
|
51
46
|
prerelease: false
|
52
|
-
|
47
|
+
version_requirements: *70225559599800
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: &70225559599340 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
|
-
requirements:
|
52
|
+
requirements:
|
55
53
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.9'
|
58
56
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rspec
|
62
57
|
prerelease: false
|
63
|
-
|
58
|
+
version_requirements: *70225559599340
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rspec
|
61
|
+
requirement: &70225559598880 !ruby/object:Gem::Requirement
|
64
62
|
none: false
|
65
|
-
requirements:
|
63
|
+
requirements:
|
66
64
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.6'
|
69
67
|
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: simplecov
|
73
68
|
prerelease: false
|
74
|
-
|
69
|
+
version_requirements: *70225559598880
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: &70225559598420 !ruby/object:Gem::Requirement
|
75
73
|
none: false
|
76
|
-
requirements:
|
74
|
+
requirements:
|
77
75
|
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.4'
|
80
78
|
type: :development
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: yard
|
84
79
|
prerelease: false
|
85
|
-
|
80
|
+
version_requirements: *70225559598420
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: yard
|
83
|
+
requirement: &70225559597960 !ruby/object:Gem::Requirement
|
86
84
|
none: false
|
87
|
-
requirements:
|
85
|
+
requirements:
|
88
86
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.7'
|
91
89
|
type: :development
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: ZenTest
|
95
90
|
prerelease: false
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: "4.5"
|
102
|
-
type: :development
|
103
|
-
version_requirements: *id008
|
104
|
-
description: A gem to provide swappable XML backends utilizing LibXML, Nokogiri, or REXML.
|
105
|
-
email:
|
106
|
-
- sferik@gmail.com
|
91
|
+
version_requirements: *70225559597960
|
92
|
+
description: A gem to provide swappable XML backends utilizing LibXML, Nokogiri, or
|
93
|
+
REXML.
|
94
|
+
email: sferik@gmail.com
|
107
95
|
executables: []
|
108
|
-
|
109
96
|
extensions: []
|
110
|
-
|
111
97
|
extra_rdoc_files: []
|
112
|
-
|
113
|
-
|
98
|
+
files:
|
99
|
+
- .autotest
|
114
100
|
- .gemtest
|
115
101
|
- .gitignore
|
116
102
|
- .rspec
|
103
|
+
- .travis.yml
|
117
104
|
- .yardopts
|
118
105
|
- Gemfile
|
119
|
-
- LICENSE.
|
120
|
-
- README.
|
106
|
+
- LICENSE.md
|
107
|
+
- README.md
|
121
108
|
- Rakefile
|
122
109
|
- lib/multi_xml.rb
|
123
|
-
- lib/multi_xml/core_extensions.rb
|
124
110
|
- lib/multi_xml/parsers/libxml.rb
|
111
|
+
- lib/multi_xml/parsers/libxml2_parser.rb
|
125
112
|
- lib/multi_xml/parsers/nokogiri.rb
|
126
113
|
- lib/multi_xml/parsers/rexml.rb
|
127
114
|
- lib/multi_xml/version.rb
|
128
115
|
- multi_xml.gemspec
|
129
116
|
- spec/helper.rb
|
130
117
|
- spec/multi_xml_spec.rb
|
118
|
+
- spec/parser_shared_example.rb
|
131
119
|
has_rdoc: true
|
132
|
-
homepage:
|
120
|
+
homepage: https://github.com/sferik/multi_xml
|
133
121
|
licenses: []
|
134
|
-
|
135
122
|
post_install_message:
|
136
123
|
rdoc_options: []
|
137
|
-
|
138
|
-
require_paths:
|
124
|
+
require_paths:
|
139
125
|
- lib
|
140
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
127
|
none: false
|
142
|
-
requirements:
|
143
|
-
- -
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version:
|
146
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
133
|
none: false
|
148
|
-
requirements:
|
149
|
-
- -
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version:
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
152
138
|
requirements: []
|
153
|
-
|
154
|
-
rubyforge_project: multi_xml
|
139
|
+
rubyforge_project:
|
155
140
|
rubygems_version: 1.6.2
|
156
141
|
signing_key:
|
157
142
|
specification_version: 3
|
158
143
|
summary: A generic swappable back-end for XML parsing
|
159
|
-
test_files:
|
144
|
+
test_files:
|
160
145
|
- spec/helper.rb
|
161
146
|
- spec/multi_xml_spec.rb
|
147
|
+
- spec/parser_shared_example.rb
|
@@ -1,108 +0,0 @@
|
|
1
|
-
class Object #:nodoc:
|
2
|
-
# @return <TrueClass, FalseClass>
|
3
|
-
#
|
4
|
-
# @example [].blank? #=> true
|
5
|
-
# @example [1].blank? #=> false
|
6
|
-
# @example [nil].blank? #=> false
|
7
|
-
#
|
8
|
-
# Returns true if the object is nil or empty (if applicable)
|
9
|
-
def blank?
|
10
|
-
nil? || (respond_to?(:empty?) && empty?)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Numeric #:nodoc:
|
15
|
-
# @return <TrueClass, FalseClass>
|
16
|
-
#
|
17
|
-
# Numerics can't be blank
|
18
|
-
def blank?
|
19
|
-
false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class NilClass #:nodoc:
|
24
|
-
# @return <TrueClass, FalseClass>
|
25
|
-
#
|
26
|
-
# Nils are always blank
|
27
|
-
def blank?
|
28
|
-
true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class TrueClass #:nodoc:
|
33
|
-
# @return <TrueClass, FalseClass>
|
34
|
-
#
|
35
|
-
# True is not blank.
|
36
|
-
def blank?
|
37
|
-
false
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class FalseClass #:nodoc:
|
42
|
-
# False is always blank.
|
43
|
-
def blank?
|
44
|
-
true
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class String #:nodoc:
|
49
|
-
# @example "".blank? #=> true
|
50
|
-
# @example " ".blank? #=> true
|
51
|
-
# @example " hey ho ".blank? #=> false
|
52
|
-
#
|
53
|
-
# @return <TrueClass, FalseClass>
|
54
|
-
#
|
55
|
-
# Strips out whitespace then tests if the string is empty.
|
56
|
-
def blank?
|
57
|
-
strip.empty?
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class Array
|
62
|
-
# Wraps its argument in an array unless it is already an array (or array-like).
|
63
|
-
#
|
64
|
-
# Specifically:
|
65
|
-
#
|
66
|
-
# * If the argument is +nil+ an empty list is returned.
|
67
|
-
# * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
|
68
|
-
# * Otherwise, returns an array with the argument as its single element.
|
69
|
-
#
|
70
|
-
# Array.wrap(nil) # => []
|
71
|
-
# Array.wrap([1, 2, 3]) # => [1, 2, 3]
|
72
|
-
# Array.wrap(0) # => [0]
|
73
|
-
#
|
74
|
-
# This method is similar in purpose to <tt>Kernel#Array</tt>, but there are some differences:
|
75
|
-
#
|
76
|
-
# * If the argument responds to +to_ary+ the method is invoked. <tt>Kernel#Array</tt>
|
77
|
-
# moves on to try +to_a+ if the returned value is +nil+, but <tt>Arraw.wrap</tt> returns
|
78
|
-
# such a +nil+ right away.
|
79
|
-
# * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, <tt>Kernel#Array</tt>
|
80
|
-
# raises an exception, while <tt>Array.wrap</tt> does not, it just returns the value.
|
81
|
-
# * It does not call +to_a+ on the argument, though special-cases +nil+ to return an empty array.
|
82
|
-
#
|
83
|
-
# The last point is particularly worth comparing for some enumerables:
|
84
|
-
#
|
85
|
-
# Array(:foo => :bar) # => [[:foo, :bar]]
|
86
|
-
# Array.wrap(:foo => :bar) # => [{:foo => :bar}]
|
87
|
-
#
|
88
|
-
# Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8
|
89
|
-
# Array.wrap("foo\nbar") # => ["foo\nbar"]
|
90
|
-
#
|
91
|
-
# There's also a related idiom that uses the splat operator:
|
92
|
-
#
|
93
|
-
# [*object]
|
94
|
-
#
|
95
|
-
# which returns <tt>[nil]</tt> for +nil+, and calls to <tt>Array(object)</tt> otherwise.
|
96
|
-
#
|
97
|
-
# Thus, in this case the behavior is different for +nil+, and the differences with
|
98
|
-
# <tt>Kernel#Array</tt> explained above apply to the rest of +object+s.
|
99
|
-
def self.wrap(object)
|
100
|
-
if object.nil?
|
101
|
-
[]
|
102
|
-
elsif object.respond_to?(:to_ary)
|
103
|
-
object.to_ary
|
104
|
-
else
|
105
|
-
[object]
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|