xml_schema 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/xml_schema/version.rb +1 -1
- data/lib/xml_schema.rb +3 -3
- data/test/xml_schema_test.rb +2 -2
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/xml_schema/version.rb
CHANGED
data/lib/xml_schema.rb
CHANGED
@@ -2,7 +2,7 @@ require 'time'
|
|
2
2
|
require 'xml_schema/ns'
|
3
3
|
|
4
4
|
module XmlSchema
|
5
|
-
TYPES = %w(
|
5
|
+
TYPES = %w(integer boolean float dateTime time date string decimal double duration gYearMonth gYear gMonthDay gDay gMonth hexBinary base64Binary anyURI QName NOTATION)
|
6
6
|
|
7
7
|
|
8
8
|
# Obtain XML Schema datatype URI for a Ruby object.
|
@@ -13,7 +13,7 @@ module XmlSchema
|
|
13
13
|
#++
|
14
14
|
case object.class.name
|
15
15
|
when "Fixnum", "Integer"
|
16
|
-
NS::XMLSchema['
|
16
|
+
NS::XMLSchema['integer']
|
17
17
|
when "TrueClass", "FalseClass"
|
18
18
|
NS::XMLSchema['boolean']
|
19
19
|
when "Float"
|
@@ -56,7 +56,7 @@ module XmlSchema
|
|
56
56
|
literal_value.sub!(/["']$/, '')
|
57
57
|
|
58
58
|
case datatype
|
59
|
-
when '
|
59
|
+
when 'integer'
|
60
60
|
literal_value.to_i
|
61
61
|
when 'boolean'
|
62
62
|
%w(1 true).include?(literal_value)
|
data/test/xml_schema_test.rb
CHANGED
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class XmlSchemaTest < Test::Unit::TestCase
|
4
4
|
def test_should_instantiate_an_integer
|
5
|
-
value = XmlSchema.instantiate "55^^<http://www.w3.org/2001/XMLSchema#
|
5
|
+
value = XmlSchema.instantiate "55^^<http://www.w3.org/2001/XMLSchema#integer>"
|
6
6
|
assert_equal 55, value
|
7
7
|
end
|
8
8
|
|
@@ -53,7 +53,7 @@ class XmlSchemaTest < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_should_return_datatype_for_integer
|
56
|
-
assert_equal URI("http://www.w3.org/2001/XMLSchema#
|
56
|
+
assert_equal URI("http://www.w3.org/2001/XMLSchema#integer"), XmlSchema.datatype_of(42)
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_should_return_datatype_for_boolean
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Helper methods and constants to handle XmlSchema
|
15
15
|
email:
|