spira 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/spira/resource/class_methods.rb +9 -1
- data/lib/spira/types/date.rb +27 -0
- data/lib/spira/version.rb +1 -1
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
@@ -71,6 +71,14 @@ module Spira
|
|
71
71
|
self.new(attributes.merge(:_subject => subject))
|
72
72
|
end
|
73
73
|
|
74
|
+
##
|
75
|
+
# Alias for #for
|
76
|
+
#
|
77
|
+
# @see #for
|
78
|
+
def [](*args)
|
79
|
+
self.for(*args)
|
80
|
+
end
|
81
|
+
|
74
82
|
##
|
75
83
|
# Creates a URI or RDF::Node based on a potential base_uri and string,
|
76
84
|
# URI, or Node, or Addressable::URI. If not a URI or Node, the given
|
@@ -137,7 +145,7 @@ module Spira
|
|
137
145
|
when false
|
138
146
|
enum_for(:each)
|
139
147
|
else
|
140
|
-
|
148
|
+
repository_or_fail.query(:predicate => RDF.type, :object => @type).each_subject do |subject|
|
141
149
|
block.call(self.for(subject))
|
142
150
|
end
|
143
151
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Spira::Types
|
2
|
+
|
3
|
+
##
|
4
|
+
# A {Spira::Type} for Date values. Values will be associated with the
|
5
|
+
# `XSD.date` type.
|
6
|
+
#
|
7
|
+
# A {Spira::Resource} property can reference this type as
|
8
|
+
# `Spira::Types::Date`, `Date`, or `XSD.Date`.
|
9
|
+
#
|
10
|
+
# @see Spira::Type
|
11
|
+
# @see http://rdf.rubyforge.org/RDF/Literal.html
|
12
|
+
class Date
|
13
|
+
|
14
|
+
include Spira::Type
|
15
|
+
|
16
|
+
def self.unserialize(value)
|
17
|
+
value.object
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.serialize(value)
|
21
|
+
RDF::Literal::Date.new(value)
|
22
|
+
end
|
23
|
+
|
24
|
+
register_alias XSD.date
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/spira/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ben Lavender
|
@@ -15,7 +15,7 @@ bindir:
|
|
15
15
|
- bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-06 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/spira/type.rb
|
128
128
|
- lib/spira/types/any.rb
|
129
129
|
- lib/spira/types/boolean.rb
|
130
|
+
- lib/spira/types/date.rb
|
130
131
|
- lib/spira/types/decimal.rb
|
131
132
|
- lib/spira/types/float.rb
|
132
133
|
- lib/spira/types/integer.rb
|