rdf-xsd 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rdf/xsd/binary.rb +30 -2
- metadata +39 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 267785fb62062f1830fb116794535556e6382013
|
4
|
+
data.tar.gz: fd11099e344fad29270e428a44ace59d6944003a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16c17ee64f55a696533012fd93bf0c4a77ddfb36e4b3abb09e654e838720b3b13d5862f987caca9197fd0385ec0cf65855d79469cad1d9926c5e0155549999b1
|
7
|
+
data.tar.gz: e380b359a3b440cf0a5ebddae0b77e3b1b52c07d311c5bdc4004759d595855f183a8e5a34de2b0c4197dd3a2e46ffb52e140336f77ac6790f2cc58e0cd65da32
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/lib/rdf/xsd/binary.rb
CHANGED
@@ -16,14 +16,40 @@ module RDF; class Literal
|
|
16
16
|
DATATYPE = XSD.hexBinary
|
17
17
|
GRAMMAR = %r(\A[0-9a-fA-F]+\Z)
|
18
18
|
|
19
|
+
##
|
20
|
+
# @param [String] value The encoded form of the literal
|
21
|
+
# @option options [String] :object (nil) decoded value
|
22
|
+
def initialize(value, options = {})
|
23
|
+
super
|
24
|
+
@object = options.fetch(:object, hex_to_bin(value.to_s))
|
25
|
+
@string ||= bin_to_hex(@object)
|
26
|
+
end
|
27
|
+
|
19
28
|
##
|
20
29
|
# Converts this literal into its canonical lexical representation.
|
21
30
|
#
|
22
31
|
# @return [RDF::Literal] `self`
|
23
32
|
def canonicalize!
|
24
|
-
@string = @object
|
33
|
+
@string = bin_to_hex(@object)
|
25
34
|
self
|
26
35
|
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Returns the encoded value as a string.
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
def to_s
|
42
|
+
@string.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def bin_to_hex(value)
|
47
|
+
value.unpack('H*').first.upcase
|
48
|
+
end
|
49
|
+
|
50
|
+
def hex_to_bin(value)
|
51
|
+
value.scan(/../).map { |x| x.hex }.pack('c*').force_encoding("BINARY")
|
52
|
+
end
|
27
53
|
end
|
28
54
|
|
29
55
|
##
|
@@ -50,7 +76,7 @@ module RDF; class Literal
|
|
50
76
|
# Converts this literal into its canonical lexical representation.
|
51
77
|
#
|
52
78
|
# @return [RDF::Literal] `self`
|
53
|
-
# @see http://www.w3.org/TR/
|
79
|
+
# @see http://www.w3.org/TR/xmlschema-2/#dateTime
|
54
80
|
def canonicalize!
|
55
81
|
@string = ::Base64.encode64(@object)
|
56
82
|
self
|
@@ -63,6 +89,8 @@ module RDF; class Literal
|
|
63
89
|
# @return [Boolean]
|
64
90
|
def valid?
|
65
91
|
Base64.strict_decode64(value.gsub(/\s+/m, ''))
|
92
|
+
rescue ArgumentError
|
93
|
+
false
|
66
94
|
end
|
67
95
|
end
|
68
96
|
end; end #RDF::Literal
|
metadata
CHANGED
@@ -1,118 +1,118 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-xsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg
|
8
8
|
- Kellogg
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: rdf
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - ~>
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: '1.1'
|
21
|
-
- -
|
20
|
+
- - '>='
|
22
21
|
- !ruby/object:Gem::Version
|
23
22
|
version: 1.1.9
|
24
|
-
|
23
|
+
name: rdf
|
25
24
|
prerelease: false
|
25
|
+
type: :runtime
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '1.1'
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.1.9
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name: activesupport
|
36
35
|
requirement: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
|
-
- -
|
37
|
+
- - ~>
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '4.1'
|
41
|
-
|
40
|
+
name: activesupport
|
42
41
|
prerelease: false
|
42
|
+
type: :development
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '4.1'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name: i18n
|
50
49
|
requirement: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
|
-
- -
|
51
|
+
- - ~>
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '0.6'
|
55
|
-
|
54
|
+
name: i18n
|
56
55
|
prerelease: false
|
56
|
+
type: :development
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.6'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
64
63
|
requirement: !ruby/object:Gem::Requirement
|
65
64
|
requirements:
|
66
|
-
- -
|
65
|
+
- - ~>
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '3.0'
|
69
|
-
|
68
|
+
name: rspec
|
70
69
|
prerelease: false
|
70
|
+
type: :development
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name: rspec-its
|
78
77
|
requirement: !ruby/object:Gem::Requirement
|
79
78
|
requirements:
|
80
|
-
- -
|
79
|
+
- - ~>
|
81
80
|
- !ruby/object:Gem::Version
|
82
81
|
version: '1.0'
|
83
|
-
|
82
|
+
name: rspec-its
|
84
83
|
prerelease: false
|
84
|
+
type: :development
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name: rdf-spec
|
92
91
|
requirement: !ruby/object:Gem::Requirement
|
93
92
|
requirements:
|
94
|
-
- -
|
93
|
+
- - ~>
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '1.1'
|
97
|
-
|
96
|
+
name: rdf-spec
|
98
97
|
prerelease: false
|
98
|
+
type: :development
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.1'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name: yard
|
106
105
|
requirement: !ruby/object:Gem::Requirement
|
107
106
|
requirements:
|
108
|
-
- -
|
107
|
+
- - ~>
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '0.8'
|
111
|
-
|
110
|
+
name: yard
|
112
111
|
prerelease: false
|
112
|
+
type: :development
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.8'
|
118
118
|
description: Adds RDF::Literal subclasses for extended XSD datatypes.
|
@@ -139,26 +139,26 @@ homepage: http://ruby-rdf.github.com/rdf-xsd
|
|
139
139
|
licenses:
|
140
140
|
- Public Domain
|
141
141
|
metadata: {}
|
142
|
-
post_install_message: "\n For best results, use nokogiri and equivalent-xml gems
|
143
|
-
as well.\n These are not hard requirements to preserve pure-ruby dependencies.\n
|
144
|
-
\
|
142
|
+
post_install_message: "\n For best results, use nokogiri and equivalent-xml gems\
|
143
|
+
\ as well.\n These are not hard requirements to preserve pure-ruby dependencies.\n\
|
144
|
+
\ "
|
145
145
|
rdoc_options: []
|
146
146
|
require_paths:
|
147
147
|
- lib
|
148
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.9.2
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project: rdf-xsd
|
160
160
|
rubygems_version: 2.4.5
|
161
|
-
signing_key:
|
161
|
+
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Extended XSD Datatypes for RDF.rb.
|
164
164
|
test_files: []
|