multi_xml 0.4.2 → 0.4.3

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/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  *.gem
2
2
  *.rbc
3
- .DS_Store
4
3
  .bundle
5
4
  .yardoc
6
5
  Gemfile.lock
@@ -1,6 +1,6 @@
1
+ language: ruby
1
2
  rvm:
2
3
  - 1.8.7
3
4
  - 1.9.2
4
5
  - 1.9.3
5
- - jruby
6
- - ree
6
+ - jruby-18mode
data/README.md CHANGED
@@ -98,10 +98,8 @@ implementations:
98
98
  * Ruby 1.9.2
99
99
  * Ruby 1.9.3
100
100
  * [JRuby][]
101
- * [Ruby Enterprise Edition][ree]
102
101
 
103
102
  [jruby]: http://www.jruby.org/
104
- [ree]: http://www.rubyenterpriseedition.com/
105
103
 
106
104
  If something doesn't work on one of these interpreters, it should be considered
107
105
  a bug.
@@ -17,8 +17,6 @@ module MultiXml
17
17
 
18
18
  CONTENT_ROOT = '__content__'.freeze unless defined?(CONTENT_ROOT)
19
19
 
20
- # TODO: use Time.xmlschema instead of Time.parse;
21
- # use regexp instead of Date.parse
22
20
  unless defined?(PARSING)
23
21
  PARSING = {
24
22
  'symbol' => Proc.new{|symbol| symbol.to_sym},
@@ -30,9 +28,9 @@ module MultiXml
30
28
  'boolean' => Proc.new{|boolean| !%w(0 false).include?(boolean.strip)},
31
29
  'string' => Proc.new{|string| string.to_s},
32
30
  'yaml' => Proc.new{|yaml| YAML::load(yaml) rescue yaml},
33
- 'base64Binary' => Proc.new{|binary| binary.unpack('m').first},
31
+ 'base64Binary' => Proc.new{|binary| ::Base64.decode64(binary)},
34
32
  'binary' => Proc.new{|binary, entity| parse_binary(binary, entity)},
35
- 'file' => Proc.new{|file, entity| parse_file(file, entity)}
33
+ 'file' => Proc.new{|file, entity| parse_file(file, entity)},
36
34
  }
37
35
 
38
36
  PARSING.update(
@@ -41,12 +39,26 @@ module MultiXml
41
39
  )
42
40
  end
43
41
 
42
+ TYPE_NAMES = {
43
+ 'Symbol' => 'symbol',
44
+ 'Fixnum' => 'integer',
45
+ 'Bignum' => 'integer',
46
+ 'BigDecimal' => 'decimal',
47
+ 'Float' => 'float',
48
+ 'TrueClass' => 'boolean',
49
+ 'FalseClass' => 'boolean',
50
+ 'Date' => 'date',
51
+ 'DateTime' => 'datetime',
52
+ 'Time' => 'datetime',
53
+ 'Array' => 'array',
54
+ 'Hash' => 'hash'
55
+ } unless defined?(TYPE_NAMES)
56
+
44
57
  class << self
45
58
  # Get the current parser class.
46
59
  def parser
47
- return @parser if @parser
60
+ return @@parser if defined?(@@parser)
48
61
  self.parser = self.default_parser
49
- @parser
50
62
  end
51
63
 
52
64
  # The default parser based on what you currently
@@ -79,9 +91,9 @@ module MultiXml
79
91
  case new_parser
80
92
  when String, Symbol
81
93
  require "multi_xml/parsers/#{new_parser.to_s.downcase}"
82
- @parser = MultiXml::Parsers.const_get("#{new_parser.to_s.split('_').map{|s| s.capitalize}.join('')}")
94
+ @@parser = MultiXml::Parsers.const_get("#{new_parser.to_s.split('_').map{|s| s.capitalize}.join('')}")
83
95
  when Class, Module
84
- @parser = new_parser
96
+ @@parser = new_parser
85
97
  else
86
98
  raise "Did not recognize your parser specification. Please specify either a symbol or a class."
87
99
  end
@@ -15,11 +15,11 @@ module MultiXml
15
15
  end
16
16
 
17
17
  def each_child(node, &block)
18
- node.each_child &block
18
+ node.each_child(&block)
19
19
  end
20
20
 
21
21
  def each_attr(node, &block)
22
- node.each_attr &block
22
+ node.each_attr(&block)
23
23
  end
24
24
 
25
25
  def node_name(node)
@@ -17,11 +17,11 @@ module MultiXml
17
17
  end
18
18
 
19
19
  def each_child(node, &block)
20
- node.children.each &block
20
+ node.children.each(&block)
21
21
  end
22
22
 
23
23
  def each_attr(node, &block)
24
- node.attribute_nodes.each &block
24
+ node.attribute_nodes.each(&block)
25
25
  end
26
26
 
27
27
  def node_name(node)
@@ -1,3 +1,3 @@
1
1
  module MultiXml
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/multi_xml/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
+ gem.add_development_dependency 'maruku'
5
6
  gem.add_development_dependency 'rake'
6
- gem.add_development_dependency 'rdiscount'
7
7
  gem.add_development_dependency 'rspec'
8
8
  gem.add_development_dependency 'simplecov'
9
9
  gem.add_development_dependency 'yard'
@@ -1,3 +1,5 @@
1
- require 'simplecov'
2
- SimpleCov.start
1
+ unless ENV['CI']
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ end
3
5
  require 'multi_xml'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-12 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
15
+ name: maruku
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -28,7 +28,7 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: rdiscount
31
+ name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 1.8.18
142
+ rubygems_version: 1.8.22
143
143
  signing_key:
144
144
  specification_version: 3
145
145
  summary: A generic swappable back-end for XML parsing