nori 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nori might be problematic. Click here for more details.
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +21 -0
- data/Rakefile +16 -0
- data/benchmark/benchmark.rb +19 -0
- data/benchmark/soap_response.xml +266 -0
- data/lib/nori.rb +18 -0
- data/lib/nori/core_ext.rb +3 -0
- data/lib/nori/core_ext/hash.rb +70 -0
- data/lib/nori/core_ext/object.rb +13 -0
- data/lib/nori/core_ext/string.rb +15 -0
- data/lib/nori/parser.rb +51 -0
- data/lib/nori/parser/nokogiri.rb +46 -0
- data/lib/nori/parser/rexml.rb +39 -0
- data/lib/nori/version.rb +5 -0
- data/lib/nori/xml_utility_node.rb +186 -0
- data/nori.gemspec +24 -0
- data/spec/nori/core_ext/hash_spec.rb +60 -0
- data/spec/nori/core_ext/object_spec.rb +15 -0
- data/spec/nori/core_ext/string_spec.rb +33 -0
- data/spec/nori/nori_spec.rb +506 -0
- data/spec/nori/parser_spec.rb +37 -0
- data/spec/spec_helper.rb +2 -0
- metadata +145 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Nori::Parser do
|
4
|
+
let(:parser) { Nori::Parser }
|
5
|
+
|
6
|
+
describe "::PARSERS" do
|
7
|
+
it "should return a Hash of parser details" do
|
8
|
+
Nori::Parser::PARSERS.should == { :rexml => "REXML", :nokogiri => "Nokogiri" }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".use" do
|
13
|
+
it "should default to REXML" do
|
14
|
+
parser.use.should == Nori::Parser::DEFAULT
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should accept a parser to use" do
|
18
|
+
parser.use = :nokogiri
|
19
|
+
parser.use.should == :nokogiri
|
20
|
+
|
21
|
+
# reset to default
|
22
|
+
parser.use = Nori::Parser::DEFAULT
|
23
|
+
parser.use.should == Nori::Parser::DEFAULT
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise an ArgumentError in case of an invalid parser" do
|
27
|
+
lambda { parser.use = :unknown }.should raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe ".parse" do
|
32
|
+
it "should load the parser to use and parse the given xml" do
|
33
|
+
parser.parse("<some>xml</some>").should == { "some" => "xml" }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nori
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Daniel Harrington
|
14
|
+
- John Nunemaker
|
15
|
+
- Wynn Netherland
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2011-04-30 00:00:00 +02:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: nokogiri
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 7
|
32
|
+
segments:
|
33
|
+
- 1
|
34
|
+
- 4
|
35
|
+
- 0
|
36
|
+
version: 1.4.0
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rspec
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 31
|
48
|
+
segments:
|
49
|
+
- 2
|
50
|
+
- 4
|
51
|
+
- 0
|
52
|
+
version: 2.4.0
|
53
|
+
type: :development
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: autotest
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
description: XML to Hash translator
|
70
|
+
email: me@rubiii.com
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .rspec
|
80
|
+
- .travis.yml
|
81
|
+
- CHANGELOG.md
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- benchmark/benchmark.rb
|
87
|
+
- benchmark/soap_response.xml
|
88
|
+
- lib/nori.rb
|
89
|
+
- lib/nori/core_ext.rb
|
90
|
+
- lib/nori/core_ext/hash.rb
|
91
|
+
- lib/nori/core_ext/object.rb
|
92
|
+
- lib/nori/core_ext/string.rb
|
93
|
+
- lib/nori/parser.rb
|
94
|
+
- lib/nori/parser/nokogiri.rb
|
95
|
+
- lib/nori/parser/rexml.rb
|
96
|
+
- lib/nori/version.rb
|
97
|
+
- lib/nori/xml_utility_node.rb
|
98
|
+
- nori.gemspec
|
99
|
+
- spec/nori/core_ext/hash_spec.rb
|
100
|
+
- spec/nori/core_ext/object_spec.rb
|
101
|
+
- spec/nori/core_ext/string_spec.rb
|
102
|
+
- spec/nori/nori_spec.rb
|
103
|
+
- spec/nori/parser_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
has_rdoc: true
|
106
|
+
homepage: http://github.com/rubiii/nori
|
107
|
+
licenses: []
|
108
|
+
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
version: "0"
|
132
|
+
requirements: []
|
133
|
+
|
134
|
+
rubyforge_project: nori
|
135
|
+
rubygems_version: 1.4.2
|
136
|
+
signing_key:
|
137
|
+
specification_version: 3
|
138
|
+
summary: XML to Hash translator
|
139
|
+
test_files:
|
140
|
+
- spec/nori/core_ext/hash_spec.rb
|
141
|
+
- spec/nori/core_ext/object_spec.rb
|
142
|
+
- spec/nori/core_ext/string_spec.rb
|
143
|
+
- spec/nori/nori_spec.rb
|
144
|
+
- spec/nori/parser_spec.rb
|
145
|
+
- spec/spec_helper.rb
|