saxy 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99471526e90dc20f81d3a7679901d55f8066939a
4
+ data.tar.gz: 8f2a8805186cf00ed9496c66c45f1e377bbb5beb
5
+ SHA512:
6
+ metadata.gz: 3af8c376d74eebcbd7ed3e94c89b69096caca4233ae5468e62f2b78ad3c43ccc4a4b66745151a439530faea6cf8841264cd045d05ff28d75f85ecece77cc4565
7
+ data.tar.gz: 37ddc5c4186622f13af8a487cfc059e36c84cd8764d8bab4685450ea7c7d26c259932da67bb77ab861c3c07c10e6ece0e192c8e9e11f6f1bfbc1f166cb35a5f1
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  script: "bundle exec rspec ./spec/"
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.0.0
4
5
  - 1.9.3
5
6
  - 1.9.2
6
7
  - 1.8.7
7
- - ree
8
+ - ree
data/README.md CHANGED
@@ -71,6 +71,7 @@ Saxy supports Enumerable, so you can use its goodies to your comfort without bui
71
71
  You can also grab an Enumerator for external use (e.g. lazy evaluation, etc.):
72
72
 
73
73
  enumerator = Saxy.parse("filename.xml", "product").each
74
+ lazy = Saxy.parse("filename.xml", "product").lazy # Ruby 2.0
74
75
 
75
76
  Multiple definitions of child objects are grouped in arrays:
76
77
 
data/lib/saxy/parser.rb CHANGED
@@ -67,9 +67,14 @@ module Saxy
67
67
  @callback = blk
68
68
 
69
69
  parser = Nokogiri::XML::SAX::Parser.new(self)
70
- parser.parse_file(@xml_file)
70
+
71
+ if @xml_file.is_a?(IO)
72
+ parser.parse_io(@xml_file)
73
+ else
74
+ parser.parse_file(@xml_file)
75
+ end
71
76
  else
72
- (Saxy.ruby_18? ? Enumerable::Enumerator : Enumerator).new(self, :each)
77
+ to_enum
73
78
  end
74
79
  end
75
80
  end
data/lib/saxy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saxy
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -5,6 +5,18 @@ describe Saxy::Parser do
5
5
 
6
6
  let(:parser) { Saxy::Parser.new(fixture_file("webstore.xml"), "product") }
7
7
 
8
+ it "should accept string filename as xml_file" do
9
+ xml_file = fixture_file("webstore.xml")
10
+ parser = Saxy::Parser.new(xml_file, "product")
11
+ parser.each.to_a.size.should == 2
12
+ end
13
+
14
+ it "should accept IO as xml_file" do
15
+ xml_file = File.new(fixture_file("webstore.xml"))
16
+ parser = Saxy::Parser.new(xml_file, "product")
17
+ parser.each.to_a.size.should == 2
18
+ end
19
+
8
20
  it "should have empty tag stack" do
9
21
  parser.tags.should == %w( )
10
22
  end
metadata CHANGED
@@ -1,74 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: saxy
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
11
5
  platform: ruby
12
- authors:
13
- - "Micha\xC5\x82 Szajbe"
6
+ authors:
7
+ - Michał Szajbe
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-02-11 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: nokogiri
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
46
34
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: rspec
50
35
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
60
48
  type: :development
61
- version_requirements: *id003
62
- description: Saxy finds object definitions in XML files and translates them into Ruby objects. It uses SAX parser under the hood, which means that it doesn't load the whole XML file into memory. It goes once though it and yields objects along the way.
63
- email:
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Saxy finds object definitions in XML files and translates them into Ruby
56
+ objects. It uses SAX parser under the hood, which means that it doesn't load the
57
+ whole XML file into memory. It goes once though it and yields objects along the
58
+ way.
59
+ email:
64
60
  - michal.szajbe@gmail.com
65
61
  executables: []
66
-
67
62
  extensions: []
68
-
69
63
  extra_rdoc_files: []
70
-
71
- files:
64
+ files:
72
65
  - .gitignore
73
66
  - .rspec
74
67
  - .travis.yml
@@ -92,38 +85,29 @@ files:
92
85
  - spec/spec_helper.rb
93
86
  homepage: http://github.com/monterail/saxy
94
87
  licenses: []
95
-
88
+ metadata: {}
96
89
  post_install_message:
97
90
  rdoc_options: []
98
-
99
- require_paths:
91
+ require_paths:
100
92
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
110
- required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
119
103
  requirements: []
120
-
121
104
  rubyforge_project:
122
- rubygems_version: 1.8.24
105
+ rubygems_version: 2.0.0
123
106
  signing_key:
124
- specification_version: 3
125
- summary: Memory-efficient XML parser. Finds object definitions and translates them into Ruby objects.
126
- test_files:
107
+ specification_version: 4
108
+ summary: Memory-efficient XML parser. Finds object definitions and translates them
109
+ into Ruby objects.
110
+ test_files:
127
111
  - spec/fixtures/webstore.xml
128
112
  - spec/fixtures_helper.rb
129
113
  - spec/saxy/element_spec.rb
@@ -131,3 +115,4 @@ test_files:
131
115
  - spec/saxy/parser_spec.rb
132
116
  - spec/saxy_spec.rb
133
117
  - spec/spec_helper.rb
118
+ has_rdoc: