timelord 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e16c0c0b745d53b8f4553109faf2a416b110265
4
- data.tar.gz: 4986c60f6647d7bcb6534f197419544db9ad9fa0
3
+ metadata.gz: b5155bc20aeb42f6a425662afb50e602404bf288
4
+ data.tar.gz: 620672c681562bddd15f34ae4d1dce1f33124595
5
5
  SHA512:
6
- metadata.gz: f8a573e32f56e46f28e0003af6ec5775cac28cc9d0302119e9e37c13e75ed30bbe6fffd9f179c9180d91b4adbd4d3db9b2ffebc6f0a4c9a7a244bd3708081ef7
7
- data.tar.gz: b89cdddbe2e9993578115c7125fe76d82a368266bac956f0ec67dfeb71c6f56f83de237cabe2e4f8c775dddb297b19e8cfc02ebb61a82f01390337b442dc4740
6
+ metadata.gz: a05dcad148204053e8d4ce6e0ccae8d89d3be17c1a1d27215cf8f7d18d073acee203da254978afc94fc58697fa837e5df5cb077168512b483da6b78e6e51a216
7
+ data.tar.gz: 06a94a35fef19b24734eb99d20903a9517bbeab86eb7655261725324a6c6b3954a25773df3adc489c582b400dce60f20a19c11bd0d658c43ab5e9f7dcecf8fb3
@@ -8,7 +8,7 @@ require 'timelord/current_weekday'
8
8
  require 'timelord/matcher_loader'
9
9
 
10
10
  module Timelord
11
- VERSION = "0.0.9"
11
+ VERSION = "0.0.10"
12
12
 
13
13
  # Parses a date str. Second parameter switches between international and american date formats.
14
14
  #
@@ -0,0 +1,15 @@
1
+ module Timelord
2
+ class LongMonthYearMatcher < Matcher
3
+ REGEX = /\b(#{LONG_MATCHER})\s+(\d{4})\b/i
4
+
5
+ def to_date
6
+ Future.new(parse_date).to_date
7
+ end
8
+
9
+ private
10
+
11
+ def parse_date
12
+ Date.civil(match[2].to_i, LONG_MONTHS.index(match[1].downcase) + 1)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Timelord
2
+ class ShortMonthYearMatcher < Matcher
3
+ REGEX = /\b(#{SHORT_MATCHER})\s+(\d{4})\b/i
4
+
5
+ def to_date
6
+ Future.new(parse_date).to_date
7
+ end
8
+
9
+ private
10
+
11
+ def parse_date
12
+ Date.civil(match[2].to_i, SHORT_MONTHS.index(match[1].downcase) + 1)
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timelord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Mongeau
@@ -74,12 +74,14 @@ files:
74
74
  - lib/timelord/matchers/day_short_month_matcher.rb
75
75
  - lib/timelord/matchers/long_month_day_matcher.rb
76
76
  - lib/timelord/matchers/long_month_matcher.rb
77
+ - lib/timelord/matchers/long_month_year_matcher.rb
77
78
  - lib/timelord/matchers/next_thursday_matcher.rb
78
79
  - lib/timelord/matchers/next_tuesday_matcher.rb
79
80
  - lib/timelord/matchers/next_weekday_matcher.rb
80
81
  - lib/timelord/matchers/ordinal_matcher.rb
81
82
  - lib/timelord/matchers/short_month_day_matcher.rb
82
83
  - lib/timelord/matchers/short_month_matcher.rb
84
+ - lib/timelord/matchers/short_month_year_matcher.rb
83
85
  - lib/timelord/matchers/today_matcher.rb
84
86
  - lib/timelord/matchers/tomorrow_matcher.rb
85
87
  - lib/timelord/matchers/year_first_matcher.rb