kronos 0.1.2 → 0.1.3

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.2
1
+ 0.1.3
data/kronos.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kronos}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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"]
data/lib/kronos.rb CHANGED
@@ -4,11 +4,14 @@ class Kronos
4
4
 
5
5
  attr_accessor :year, :month, :day
6
6
 
7
+ IGNORE_PATTERN = Regexp.compile("^prior")
8
+
7
9
  def parse(string)
8
10
  if string =~ /^\d{4}$/
9
11
  self.year = string.to_i
10
12
  elsif string =~ /^[']?(\d{2})$/
11
13
  self.year = to_full_year($1.to_i)
14
+ elsif string =~ IGNORE_PATTERN
12
15
  else
13
16
  values = ParseDate.parsedate(string)
14
17
  if values[0]
data/spec/kronos_spec.rb CHANGED
@@ -132,7 +132,15 @@ describe "Kronos" do
132
132
  c = Kronos.parse("unknown")
133
133
  c.year.should == nil
134
134
  c.month.should == nil
135
- c.day.should == nil
135
+ c.day.should == nil
136
+ c.to_hash.should == {}
137
+ end
138
+
139
+ it "prior to 1998" do
140
+ c = Kronos.parse("prior to 1998")
141
+ c.year.should == nil
142
+ c.month.should == nil
143
+ c.day.should == nil
136
144
  c.to_hash.should == {}
137
145
  end
138
146
 
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David James