ohm-contrib 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.30
1
+ 0.0.31
@@ -111,17 +111,8 @@ module Ohm
111
111
  class Time < Primitive
112
112
  delegate_to ::Time
113
113
 
114
- YYYY_MM_DD = /\A([0-9]{4})-([01]?[0-9])-([0123]?[0-9])\z/
115
- YYYY_MM_DD_HH_MM_SS = /\A([0-9]{4})-([01]?[0-9])-([0123]?[0-9]) ([\d]{1,2}):([\d]{1,2})(:([\d]{1,2}))?\z/
116
-
117
114
  def object
118
- if @raw =~ YYYY_MM_DD
119
- ::Time.utc($1, $2, $3)
120
- elsif @raw =~ YYYY_MM_DD_HH_MM_SS
121
- ::Time.utc($1, $2, $3, $4, $5, $7)
122
- else
123
- ::Time.parse(@raw)
124
- end
115
+ ::Time.parse(@raw).utc
125
116
  end
126
117
  end
127
118
 
data/lib/ohm/contrib.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Ohm
2
2
  module Contrib
3
- VERSION = '0.0.30'
3
+ VERSION = '0.0.31'
4
4
  end
5
5
 
6
6
  autoload :Boundaries, "ohm/contrib/boundaries"
data/ohm-contrib.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ohm-contrib}
8
- s.version = "0.0.30"
8
+ s.version = "0.0.31"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cyril David"]
@@ -262,7 +262,7 @@ class TestOhmTypecast < Test::Unit::TestCase
262
262
  end
263
263
 
264
264
  test "allows for real time operations" do
265
- post = Post.create(:created_at => "2010-05-10")
265
+ post = Post.create(:created_at => "2010-05-10T00:00Z")
266
266
  post = Post[post.id]
267
267
 
268
268
  assert_respond_to post.created_at, :strftime
@@ -296,8 +296,8 @@ class TestOhmTypecast < Test::Unit::TestCase
296
296
  attribute :printed_at, Time
297
297
  end
298
298
 
299
- test "2010-08-07 is parsed as 2010-08-07 00:00:00 UTC" do
300
- post = Post.new(:printed_at => "2010-08-07")
299
+ test "2010-08-07T00:00Z is parsed as 2010-08-07 00:00:00 UTC" do
300
+ post = Post.new(:printed_at => "2010-08-07T00:00Z")
301
301
  assert_equal Time.utc(2010, 8, 7).to_s, post.printed_at.utc.to_s
302
302
 
303
303
  post.save
@@ -305,17 +305,8 @@ class TestOhmTypecast < Test::Unit::TestCase
305
305
  assert_equal Time.utc(2010, 8, 7).to_s, post.printed_at.utc.to_s
306
306
  end
307
307
 
308
- test "2010-08-07 00:00 is parsed as 2010-08-07 00:00:00 UTC" do
309
- post = Post.new(:printed_at => "2010-08-07 00:00")
310
- assert_equal Time.utc(2010, 8, 7).to_s, post.printed_at.utc.to_s
311
-
312
- post.save
313
- post = Post[post.id]
314
- assert_equal Time.utc(2010, 8, 7).to_s, post.printed_at.utc.to_s
315
- end
316
-
317
- test "2010-08-07 18:29 is parsed as 2010-08-07 18:29:00 UTC" do
318
- post = Post.new(:printed_at => "2010-08-07 18:29")
308
+ test "2010-08-07 18:29Z is parsed as 2010-08-07 18:29:00 UTC" do
309
+ post = Post.new(:printed_at => "2010-08-07 18:29Z")
319
310
  assert_equal Time.utc(2010, 8, 7, 18, 29).to_s, post.printed_at.utc.to_s
320
311
 
321
312
  post.save
@@ -323,8 +314,8 @@ class TestOhmTypecast < Test::Unit::TestCase
323
314
  assert_equal Time.utc(2010, 8, 7, 18, 29).to_s, post.printed_at.utc.to_s
324
315
  end
325
316
 
326
- test "2010-08-07 18:29:31 is parsed as 2010-08-07 18:29:31 UTC" do
327
- post = Post.new(:printed_at => "2010-08-07 18:29:31")
317
+ test "2010-08-07T18:29:31Z is parsed as 2010-08-07 18:29:31 UTC" do
318
+ post = Post.new(:printed_at => "2010-08-07T18:29:31Z")
328
319
  assert_equal Time.utc(2010, 8, 7, 18, 29, 31).to_s, post.printed_at.utc.to_s
329
320
 
330
321
  post.save
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 30
9
- version: 0.0.30
8
+ - 31
9
+ version: 0.0.31
10
10
  platform: ruby
11
11
  authors:
12
12
  - Cyril David