Commit e1a5b712453b209dec9beae26243e611f6d1ec1f

added xmlschema serialization format for Time objects
  
2727
2828 # document version regexp
2929 VERSION_RE = UUID_RE
30
31
30
31 # XML Schema time format
32 # Time.now.xmlschema(6)
33 # #=> "2008-04-27T23:39:09.920288+04:00"
34 # Time.xmlschema("2008-04-27T23:39:09.920288+04:00")
35 # #=> Sun Apr 27 19:39:09 UTC 2008
36 XMLSCHEMA_TIME_RE = /\A\s*(-?\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d*)?(Z|[+-]\d\d:\d\d)?\s*\z/i
37
3238 # STROKEDB NSURL
3339 STROKEDB_NSURL = "http://strokedb.com/"
3440
  
145145 "@!Dump:#{StrokeDB::serialize(v)}"
146146 when Symbol
147147 v.to_s
148 when Time, String, Numeric, TrueClass, FalseClass, NilClass
148 when String, Numeric, TrueClass, FalseClass, NilClass
149149 v
150 when Time
151 v.xmlschema(6)
150152 else
151153 raise ArgumentError, "#{v.class} is not a valid slot value type"
152154 end
180180 end
181181 when Symbol
182182 v.to_s
183 when XMLSCHEMA_TIME_RE
184 Time.xmlschema(v).localtime # localtime is for compliance with local time objects
183185 else
184186 v
185187 end
  
4040require 'util/serialization'
4141require 'util/uuid'
4242require 'util/xml'
43require 'time'
4344require 'util/java_util' if RUBY_PLATFORM =~ /java/
  
5959 t = Time.now
6060 @slot.value = t
6161 @slot.value.should == t
62 pending("Time objects special serialization is not yet implemented")
63 @slot.to_raw.should match(/some_regexp/)
62 @slot.to_raw.should match(XMLSCHEMA_TIME_RE)
6463 end
6564
6665 it "should store VersionedDocument reference if value is a saved Document" do