kronos 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kronos}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David James"]
12
- s.date = %q{2009-12-01}
12
+ s.date = %q{2009-12-02}
13
13
  s.description = %q{Kronos provides flexible date parsing. Currently just a thin layer on top of ParseDate.}
14
14
  s.email = %q{djames@sunlightfoundation.com}
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,14 @@ class Kronos
19
19
  self
20
20
  end
21
21
 
22
+ def to_hash
23
+ h = {}
24
+ h['year'] = year if year
25
+ h['month'] = month if month
26
+ h['day'] = day if day
27
+ h
28
+ end
29
+
22
30
  def self.parse(string)
23
31
  self.new.parse(string)
24
32
  end
@@ -6,7 +6,12 @@ describe "Kronos" do
6
6
  c = Kronos.parse("15-Mar-2001")
7
7
  c.year.should == 2001
8
8
  c.month.should == 3
9
- c.day.should == 15
9
+ c.day.should == 15
10
+ c.to_hash.should == {
11
+ 'year' => 2001,
12
+ 'month' => 3,
13
+ 'day' => 15,
14
+ }
10
15
  end
11
16
 
12
17
  it "January 1976" do
@@ -14,6 +19,10 @@ describe "Kronos" do
14
19
  c.year.should == 1976
15
20
  c.month.should == 1
16
21
  c.day.should == nil
22
+ c.to_hash.should == {
23
+ 'year' => 1976,
24
+ 'month' => 1,
25
+ }
17
26
  end
18
27
 
19
28
  it "1991" do
@@ -21,6 +30,9 @@ describe "Kronos" do
21
30
  c.year.should == 1991
22
31
  c.month.should == nil
23
32
  c.day.should == nil
33
+ c.to_hash.should == {
34
+ 'year' => 1991,
35
+ }
24
36
  end
25
37
 
26
38
  it "91" do
@@ -28,6 +40,9 @@ describe "Kronos" do
28
40
  c.year.should == 1991
29
41
  c.month.should == nil
30
42
  c.day.should == nil
43
+ c.to_hash.should == {
44
+ 'year' => 1991,
45
+ }
31
46
  end
32
47
 
33
48
  it "'91" do
@@ -35,6 +50,9 @@ describe "Kronos" do
35
50
  c.year.should == 1991
36
51
  c.month.should == nil
37
52
  c.day.should == nil
53
+ c.to_hash.should == {
54
+ 'year' => 1991,
55
+ }
38
56
  end
39
57
 
40
58
  it "2019" do
@@ -42,6 +60,9 @@ describe "Kronos" do
42
60
  c.year.should == 2019
43
61
  c.month.should == nil
44
62
  c.day.should == nil
63
+ c.to_hash.should == {
64
+ 'year' => 2019,
65
+ }
45
66
  end
46
67
 
47
68
  it "19" do
@@ -49,6 +70,9 @@ describe "Kronos" do
49
70
  c.year.should == 2019
50
71
  c.month.should == nil
51
72
  c.day.should == nil
73
+ c.to_hash.should == {
74
+ 'year' => 2019,
75
+ }
52
76
  end
53
77
 
54
78
  it "'19" do
@@ -56,6 +80,9 @@ describe "Kronos" do
56
80
  c.year.should == 2019
57
81
  c.month.should == nil
58
82
  c.day.should == nil
83
+ c.to_hash.should == {
84
+ 'year' => 2019,
85
+ }
59
86
  end
60
87
 
61
88
  it "1/17/2007" do
@@ -63,13 +90,19 @@ describe "Kronos" do
63
90
  c.year.should == 2007
64
91
  c.month.should == 1
65
92
  c.day.should == 17
93
+ c.to_hash.should == {
94
+ 'year' => 2007,
95
+ 'month' => 1,
96
+ 'day' => 17,
97
+ }
66
98
  end
67
99
 
68
- it "" do
100
+ it "empty string" do
69
101
  c = Kronos.parse("")
70
102
  c.year.should == nil
71
103
  c.month.should == nil
72
104
  c.day.should == nil
105
+ c.to_hash.should == {}
73
106
  end
74
107
 
75
108
  it "unknown" do
@@ -77,6 +110,7 @@ describe "Kronos" do
77
110
  c.year.should == nil
78
111
  c.month.should == nil
79
112
  c.day.should == nil
113
+ c.to_hash.should == {}
80
114
  end
81
115
 
82
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kronos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David James
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-01 00:00:00 -05:00
12
+ date: 2009-12-02 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency