medjool 0.1 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -2,23 +2,26 @@ medjool
2
2
  =======
3
3
  Date parsing with context.
4
4
 
5
- The Date.parse in ActiveSupport method is awesome. The only thing it lacks is the ability to provide a bit more context to override what 'now' is considered to be. By default, Medjool defers date parsing directly to Date.parse, but on subsequent calls it will make sure that the result is after the previously parsed date.
5
+ The Date.parse method in ActiveSupport method is awesome. The only thing it lacks is the ability to provide a bit more context to override what 'now' is considered to be. By default, Medjool defers date parsing directly to Date.parse. On subsequent calls, if ambiguity exists in the parsed date, it will make sure that the result is after the previously parsed date.
6
6
 
7
7
  Usage
8
8
  =====
9
9
 
10
+ ```
10
11
  parser = Medjool::Parser.new({:now => "2013-08-26".to_date})
11
12
  parser.parse("Tuesday") => "2013-08-27"
12
13
  parser.parse("Wednesday") => "2013-08-28"
13
14
  parser.parse("Tuesday") => "2013-09-03"
14
-
15
+ ```
15
16
 
16
17
  Tests
17
18
  =====
18
19
  To run the tests, type:
19
20
 
21
+ ```
20
22
  rake test
23
+ ```
21
24
 
22
25
  License
23
26
  =======
24
- Medjool is licensed under an MIT license.
27
+ Medjool is licensed under an MIT license.
@@ -1,5 +1,5 @@
1
1
  module Medjool
2
- DAYNAME_MATCHER = /(\s*Mon(day)?,?\s*|\s*Tue(s(day)?)?,?\s*|\s*Wed(nesday)?,?\s*|\s*Thur(s(day)?)?,?\s*|\s*Fri(day)?,?\s*|\s*Sat(urday)?,?\s*|\s*Sun(day)?,?\s*)/
2
+ DAYNAME_MATCHER = /(\s*Mon(day)?,?\s*|\s*Tue(s(day)?)?,?\s*|\s*Wed(nesday)?,?\s*|\s*Thu(r(s(day)?)?)?,?\s*|\s*Fri(day)?,?\s*|\s*Sat(urday)?,?\s*|\s*Sun(day)?,?\s*)/
3
3
  MONTH_MATCHER = /\s*(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|June?|July?|Aug(ust)?|Sept(ember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?),?\s*/
4
4
  YYYY_MM_DD_MATCHER = /(\s*[0-9]{4}-[0-9]{2}-[0-9]{2}\s*)/
5
5
  DM_DM_YYYY_MATCHER = /(\s*[0-9]{2}[-\/][0-9]{2}[-\/][0-9]{2,4}\s*)/
data/lib/medjool.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Medjool
2
- VERSION = 0.1
2
+ VERSION = 0.2
3
3
 
4
4
  require 'medjool/parser'
5
5
  require 'medjool/regexs'
data/test/test_medjool.rb CHANGED
@@ -12,7 +12,7 @@ class TestMedjool < TestCase
12
12
  end
13
13
 
14
14
  def test_parse_without_context
15
- @variations = ["Monday", "1st July", "2nd July 2010", "1 July 2009", "Monday 2nd July 2009", "Monday 2nd", "Monday 2", "Monday 2 July"]
15
+ @variations = ["Thu", "Monday", "1st July", "2nd July 2010", "1 July 2009", "Monday 2nd July 2009", "Monday 2nd", "Monday 2", "Monday 2 July"]
16
16
  @variations.each do |t|
17
17
  assert_equal Date.parse(t), Medjool.parse(t)
18
18
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medjool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Geers
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-08-26 00:00:00 Z
17
+ date: 2013-09-16 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport