datet 0.0.9 → 0.0.10

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.9
1
+ 0.0.10
data/datet.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datet}
8
- s.version = "0.0.9"
8
+ s.version = "0.0.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-07-16}
12
+ s.date = %q{2012-07-19}
13
13
  s.description = %q{A framework for handeling date- and time-related stuff in Ruby.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
data/lib/datet.rb CHANGED
@@ -1117,6 +1117,8 @@ class Datet
1117
1117
  return Datet.new(match[1].to_i, match[2].to_i, match[3].to_i, match[5].to_i, match[6].to_i, match[7].to_i)
1118
1118
  elsif match = timestr_t.match(/^([A-z]+),\s*(\d+)\s+([A-z]+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s*([A-z]+)$/)
1119
1119
  return Datet.new(match[4].to_i, Datet.month_str_to_no(match[3]), match[2].to_i, match[5].to_i, match[6].to_i, match[7].to_i)
1120
+ elsif match = timestr_t.match(/^(\d{4})-(\d{2})-(\d{2})t(\d{2}):(\d{2}):(\d{2})\+(\d{4}$)$/)
1121
+ return Datet.new(match[1].to_i, match[2].to_i, match[3].to_i, match[4].to_i, match[5].to_i, match[6].to_i)
1120
1122
  end
1121
1123
 
1122
1124
  raise ArgumentError, "Wrong format: '#{timestr}', class: '#{timestr.class.name}'"
data/spec/datet_spec.rb CHANGED
@@ -53,6 +53,9 @@ describe "Datet" do
53
53
  date = Datet.in("17/06 1985").time
54
54
  date = Datet.in("2012-06-06").time
55
55
 
56
+ date = Datet.in("2012-06-20T08:25:06+0000")
57
+ raise "Expected '2012-06-20 08:25:06' but got: '#{date.dbstr}'." if date.dbstr != "2012-06-20 08:25:06"
58
+
56
59
  raise "Couldnt register type 1 nullstamp." if !Datet.is_nullstamp?("0000-00-00")
57
60
  raise "Couldnt register type 2 nullstamp." if !Datet.is_nullstamp?("0000-00-00 00:00:00")
58
61
  raise "Registered nullstamp on valid date." if Datet.is_nullstamp?("1985-06-17")
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: datet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.9
5
+ version: 0.0.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-16 00:00:00 +02:00
13
+ date: 2012-07-19 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- hash: 1974701347137718531
96
+ hash: -53857754669353741
97
97
  segments:
98
98
  - 0
99
99
  version: "0"