Commit e1a5b712453b209dec9beae26243e611f6d1ec1f
- Diff rendering mode:
- inline
- side by side
lib/strokedb.rb
(8 / 2)
|   | |||
| 27 | 27 | ||
| 28 | 28 | # document version regexp | |
| 29 | 29 | 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 | |||
| 32 | 38 | # STROKEDB NSURL | |
| 33 | 39 | STROKEDB_NSURL = "http://strokedb.com/" | |
| 34 | 40 |
|   | |||
| 145 | 145 | "@!Dump:#{StrokeDB::serialize(v)}" | |
| 146 | 146 | when Symbol | |
| 147 | 147 | v.to_s | |
| 148 | when Time, String, Numeric, TrueClass, FalseClass, NilClass | ||
| 148 | when String, Numeric, TrueClass, FalseClass, NilClass | ||
| 149 | 149 | v | |
| 150 | when Time | ||
| 151 | v.xmlschema(6) | ||
| 150 | 152 | else | |
| 151 | 153 | raise ArgumentError, "#{v.class} is not a valid slot value type" | |
| 152 | 154 | end | |
| … | … | ||
| 180 | 180 | end | |
| 181 | 181 | when Symbol | |
| 182 | 182 | v.to_s | |
| 183 | when XMLSCHEMA_TIME_RE | ||
| 184 | Time.xmlschema(v).localtime # localtime is for compliance with local time objects | ||
| 183 | 185 | else | |
| 184 | 186 | v | |
| 185 | 187 | end |
lib/strokedb/util.rb
(1 / 0)
|   | |||
| 40 | 40 | require 'util/serialization' | |
| 41 | 41 | require 'util/uuid' | |
| 42 | 42 | require 'util/xml' | |
| 43 | require 'time' | ||
| 43 | 44 | require 'util/java_util' if RUBY_PLATFORM =~ /java/ |
|   | |||
| 59 | 59 | t = Time.now | |
| 60 | 60 | @slot.value = t | |
| 61 | 61 | @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) | ||
| 64 | 63 | end | |
| 65 | 64 | ||
| 66 | 65 | it "should store VersionedDocument reference if value is a saved Document" do |

