quando 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.rspec +1 -0
- data/Gemfile.lock +2 -2
- data/LICENSE.md +21 -0
- data/README.md +177 -19
- data/bin/console +7 -0
- data/lib/quando/config.rb +63 -34
- data/lib/quando/parser.rb +5 -2
- data/lib/quando/version.rb +1 -1
- data/lib/quando.rb +9 -1
- data/quando.png +0 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6c1973b3643f2518981fb2adee83308115f6e11f60f8b558c840bca6f7fd32e
|
4
|
+
data.tar.gz: 4ffe51a57833e4f4c1be7376c9a8cd7a613b407ce9ae753f60ae2060b6dc6137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ffe9976de04d37d34310d00650c5b1394b485e8c7ae39ec2ee50534f5fadc5a9fcc7871ddb6d02cdd1417976deb5783424555ccf410edb710342e474c49cdd8
|
7
|
+
data.tar.gz: e0254d48250868d689dabc06d43e00f078b0fa0f6fe14d768c9cafa97bdff66fc44df2361af5577def1e16fbd6341bd56223bee455f5b0a098f5d18668e10c01
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018-2019 Sergey Konotopov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,50 +1,208 @@
|
|
1
|
-
|
1
|
+
![Quando](quando.png "Quando")
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/quando.svg)](https://badge.fury.io/rb/quando)
|
4
4
|
[![Build Status](https://semaphoreci.com/api/v1/kinkou/quando/branches/master/shields_badge.svg)](https://semaphoreci.com/kinkou/quando)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/b0653fc45ec54c23e05c/maintainability)](https://codeclimate.com/github/kinkou/quando/maintainability)
|
6
6
|
|
7
|
-
Quando is a configurable date parser.
|
7
|
+
Quando is a configurable date parser which picks up where ```Date.strptime``` stops. It was made to work with non-standard, multi-language dates (that is, dates recorded by humans in languages other than English) but can be used for almost any date format.
|
8
|
+
|
9
|
+
A typical use case for Quando is dealing with input like:
|
10
|
+
|
11
|
+
```text
|
12
|
+
"01 января 2019 г."
|
13
|
+
"1-ЯНВ-19"
|
14
|
+
"01.01.19"
|
15
|
+
"1/Jan/2019"
|
16
|
+
"yanvar'19"
|
17
|
+
"ЯНВ"
|
18
|
+
```
|
19
|
+
|
20
|
+
This is a real-life example of how people would routinely write January 1, 2019 in Russia, but since many countries have their own words for month names, it might be a common problem.
|
21
|
+
|
22
|
+
## How it works
|
23
|
+
|
24
|
+
```bash
|
25
|
+
gem install quando
|
26
|
+
```
|
27
|
+
|
28
|
+
and then
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'quando'
|
32
|
+
|
33
|
+
Quando.configure do |c|
|
34
|
+
# Define regular expressions to identify possible month names:
|
35
|
+
c.jan = /january|jan|yanvar|январь|января|янв/i # simplified for readability
|
36
|
+
# c.feb = …
|
37
|
+
|
38
|
+
# …more configuration…
|
39
|
+
|
40
|
+
# Then combine them into regexps that will match the date formats you accept:
|
41
|
+
c.formats = [
|
42
|
+
/#{c.day} #{c.month_txt} #{c.year} г\./i, # matches "01 января 2019 г."
|
43
|
+
/#{c.day}\.#{c.month_num}\.#{c.year2}/i, # matches "01.01.19"
|
44
|
+
/#{c.month_txt}'#{c.year2}/i, # matches "январь'19"
|
45
|
+
/#{c.month_txt}/i, # matches "ЯНВ"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
Quando.parse("01 января 2019 г.") #=> #<Date: 2019-01-01>
|
50
|
+
Quando.parse("01.01.19") #=> #<Date: 2019-01-01>
|
51
|
+
Quando.parse("январь'19") #=> #<Date: 2019-01-01>
|
52
|
+
Quando.parse("ЯНВ") #=> #<Date: 2019-01-01> (given that current year is 2019)
|
53
|
+
```
|
54
|
+
|
55
|
+
## Quando in detail
|
56
|
+
|
57
|
+
### Configuration object
|
58
|
+
|
59
|
+
Configuration properties can be set by submitting a block to the ```Quando.configure``` method, as seen in the example above, or by calling the setter methods on the configuration object directly:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Quando.config.jun = /qershor|mehefin/ # Albanian and Welsh month names
|
63
|
+
Quando.config.jul = /korrik|gorffennaf/ # will make you cry
|
64
|
+
```
|
65
|
+
|
66
|
+
### Regular expressions
|
67
|
+
|
68
|
+
If you need to use grouping, remember that non-capturing groups ```(?:abc)``` provide better performance.
|
69
|
+
|
70
|
+
If, for some reason, you need to use named groups ```(?<name>abc)```, avoid names ```day```, ```month``` and ```year```. Quando uses them internally, so conflicts are possible.
|
71
|
+
|
72
|
+
### Textual month matchers
|
73
|
+
|
74
|
+
To let Quando recognize months in your language you need to define corresponding regular expressions for all months:
|
8
75
|
|
9
|
-
#### Application-level:
|
10
76
|
```ruby
|
11
77
|
Quando.configure do |c|
|
12
|
-
|
78
|
+
# In Finland, your matchers might look like this:
|
79
|
+
c.jan = /jan(?:uary)? | tammikuu(?:ta)? /xi
|
80
|
+
c.feb = /feb(?:ruary)? | helmikuu(?:ta)? /xi
|
81
|
+
c.mar = /mar(?:ch)? | maaliskuu(?:ta)?/xi
|
82
|
+
c.apr = /apr(?:il)? | huhtikuu(?:ta)? /xi
|
83
|
+
c.may = /may | toukokuu(?:ta)? /xi
|
84
|
+
c.jun = /june? | kesäkuu(?:ta)? /xi
|
85
|
+
c.jul = /july? | heinäkuu(?:ta)? /xi
|
86
|
+
c.aug = /aug(?:ust)? | elokuu(?:ta)? /xi
|
87
|
+
c.sep = /sep(?:tember)? | syyskuu(?:ta)? /xi
|
88
|
+
c.oct = /oct(?:ober)? | lokakuu(?:ta)? /xi
|
89
|
+
c.nov = /nov(?:ember)? | marraskuu(?:ta)?/xi
|
90
|
+
c.dec = /dec(?:ember)? | joulukuu(?:ta)? /xi
|
91
|
+
|
92
|
+
# …more configuration…
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
### Numerical matchers
|
97
|
+
|
98
|
+
Quando comes with defaults that will probably work in most situations:
|
99
|
+
|
100
|
+
```Quando.config.day``` matches numbers from 1 to 31, both zero-padded and unpadded;
|
13
101
|
|
14
|
-
|
15
|
-
c.feb = /fevereiro/i
|
16
|
-
c.mar = /março/i
|
17
|
-
c.apr = /abril/i
|
18
|
-
# …
|
19
|
-
c.unimonth!
|
102
|
+
```Quando.config.month_num``` matches numbers from 1 to 12, both zero-padded and unpadded;
|
20
103
|
|
104
|
+
```Quando.config.year``` matches any 4-digit sequence;
|
105
|
+
```Quando.config.year2``` matches any 2-digit sequence.
|
106
|
+
|
107
|
+
If you need to adjust these matchers make sure that they produce named captures ```day```, ```month``` and ```year```, respectively:
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
Quando.config.day = /(?<day> …)/
|
111
|
+
Quando.config.month_num = /(?<month> …)/
|
112
|
+
Quando.config.year = /(?<year> …)/
|
113
|
+
```
|
114
|
+
|
115
|
+
### Delimiter matcher
|
116
|
+
|
117
|
+
By default, ```Quando.config.dlm``` will greedily match spaces, dashes, dots and slashes.
|
118
|
+
|
119
|
+
### Format matchers
|
120
|
+
|
121
|
+
With format matchers you describe the concrete date formats that Quando will recognize. Within them you can include the date part matchers you defined previously.
|
122
|
+
|
123
|
+
```Quando.config.day```, ```Quando.config.month_num```, ```Quando.config.month_txt```, ```Quando.config.year```, ```Quando.config.year2``` can be used.
|
124
|
+
|
125
|
+
```Quando.config.month_txt``` is a regexp that automatically combines all textual month matchers, and will thus match any month.
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
Quando.configure do |c|
|
129
|
+
# …some initial configuration…
|
130
|
+
|
21
131
|
c.formats = [
|
22
|
-
|
23
|
-
|
132
|
+
/^ #{c.day} #{c.dlm} #{c.month_txt} #{c.dlm} #{c.year} $/xi,
|
133
|
+
# compiles into something like
|
134
|
+
# /^ (?<day>…) [ .]+ (?<month>jan|feb|…) [ .]+ (?<year>…) $/xi
|
135
|
+
# and returns ~ #<MatchData "14 Apr 1965" day:"14" month:"Apr" year:"1965">
|
136
|
+
# on successful match
|
24
137
|
]
|
25
138
|
end
|
139
|
+
```
|
140
|
+
|
141
|
+
### How dates are parsed
|
142
|
+
|
143
|
+
Quando matches regular expressions from ```Quando.config.formats```, *in the specified order*, against the input. If there is a match, the resulting ```MatchData``` object is analyzed.
|
144
|
+
|
145
|
+
If there is a named capture ```:day``` or ```:month```, either is used in the result, given that they are within correct range. If the format matcher did not define such named group, ```1``` is used:
|
26
146
|
|
27
|
-
|
28
|
-
Quando.
|
147
|
+
```ruby
|
148
|
+
Quando.config.formats = [
|
149
|
+
/#{Quando.config.month_num}\.#{Quando.config.year}/
|
150
|
+
]
|
151
|
+
|
152
|
+
Quando.parse('04.2019') #=> #<Date: 2019-04-01>
|
29
153
|
```
|
30
154
|
|
31
|
-
|
32
|
-
|
155
|
+
If there is a named capture ```:year```, it is used in the result. If the format matcher did not define such named group, current year is used. If the captured value is less than ```100``` (which is the case for years written as 2-digit numbers), Quando will add a value from ```Quando.config.century``` (defaults to ```2000```), effectively converting, for example, ```18``` to ```2018``` (ok, it's not really a century, but rather a *nittonhundratalet*, but let's keep things simple). Be mindful of this behaviour, adjusting ```Quando.config.century``` accordingly:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
Quando.config.formats = [Quando.config.year]
|
159
|
+
Quando.parse('2019') #=> #<Date: 2019-01-01>
|
160
|
+
|
161
|
+
Quando.config.formats = [Quando.config.year2]
|
162
|
+
Quando.parse('65') #=> #<Date: 2065-01-01>
|
163
|
+
|
164
|
+
Quando.parse('65', century: 1900) #=> #<Date: 1965-01-01>
|
165
|
+
# or
|
166
|
+
Quando.config.century = 1900
|
167
|
+
Quando.parse('65') #=> #<Date: 1965-01-01>
|
168
|
+
```
|
169
|
+
|
170
|
+
### Defaults
|
171
|
+
|
172
|
+
Out of the box, Quando will parse a reasonable variety of day-month-year ordered numerical and English textual dates. Some examples:
|
173
|
+
|
174
|
+
```text
|
175
|
+
14.4.1965, 14/04/1965, …
|
176
|
+
14-apr-1965, 14 Apr 1965, …
|
177
|
+
April 1965, apr 1965, …
|
178
|
+
13.12.05, 13-12-05, …
|
179
|
+
April, APR, …
|
180
|
+
```
|
181
|
+
|
182
|
+
See ```Quando.config.formats``` for details.
|
183
|
+
|
184
|
+
### Multiple ways to configure
|
185
|
+
|
186
|
+
You can configure Quando instances independently of each other and of the class:
|
187
|
+
|
33
188
|
```ruby
|
34
189
|
Quando.parse('14-abril-1965') #=> nil
|
35
190
|
|
36
191
|
date_parser = Quando::Parser.new.configure do |c|
|
37
|
-
#
|
192
|
+
# …some configuration…
|
38
193
|
end
|
39
194
|
date_parser.parse('14-abril-1965') #=> #<Date: 1965-04-14>
|
40
195
|
|
41
196
|
Quando.parse('14-abril-1965') #=> nil
|
42
197
|
```
|
43
198
|
|
44
|
-
|
199
|
+
or just pass a format matcher as a parameter:
|
200
|
+
|
45
201
|
```ruby
|
46
202
|
m = /(?<year>#{Quando.config.year}) (?<day>\d\d) (?<month>[A-Z]+)/i
|
47
203
|
Quando.parse('1965 14 Apr', matcher: m) #=> #<Date: 1965-04-14>
|
48
204
|
```
|
49
205
|
|
50
|
-
|
206
|
+
### Requirements
|
207
|
+
|
208
|
+
Ruby >= 1.9.3. Enjoy!
|
data/bin/console
ADDED
data/lib/quando/config.rb
CHANGED
@@ -4,77 +4,106 @@
|
|
4
4
|
module Quando
|
5
5
|
class Config
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
:formats
|
12
|
-
]
|
7
|
+
MONTHS = [:jan, :feb, :mar, :apr, :may, :jun, :jul, :aug, :sep, :oct, :nov, :dec]
|
8
|
+
AUTOUPDATE = [:dlm, :year, :year2, :day, *MONTHS, :month_num]
|
9
|
+
COMPOUND = [:month_txt, :formats]
|
10
|
+
OPTIONS = [*AUTOUPDATE, *COMPOUND, :century]
|
13
11
|
|
14
|
-
|
12
|
+
private_constant :AUTOUPDATE, :COMPOUND, :OPTIONS
|
15
13
|
|
16
|
-
|
14
|
+
attr_accessor *OPTIONS
|
17
15
|
|
18
16
|
def initialize
|
19
|
-
@
|
20
|
-
|
21
|
-
@
|
22
|
-
@
|
23
|
-
|
24
|
-
@
|
25
|
-
@
|
26
|
-
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
17
|
+
@century = 2000
|
18
|
+
|
19
|
+
@dlm = /[ -.\/]+/
|
20
|
+
@year = /(?<year> \d{4})/x
|
21
|
+
@year2 = /(?<year> \d{2})/x
|
22
|
+
@month_num = /(?<month> 1[0-2] | 0?[1-9])/x
|
23
|
+
@day = /(?<day> 3[0-1] | [12][0-9] | 0?[1-9])/x
|
24
|
+
|
25
|
+
@jan = /JAN(?:UARY)?/xi
|
26
|
+
@feb = /FEB(?:RUARY)? /xi
|
27
|
+
@mar = /MAR(?:CH)?/xi
|
28
|
+
@apr = /APR(?:IL)?/xi
|
29
|
+
@may = /MAY/xi
|
30
|
+
@jun = /JUNE?/xi
|
31
|
+
@jul = /JULY?/xi
|
32
|
+
@aug = /AUG(?:UST)?/xi
|
33
|
+
@sep = /SEP(?:TEMBER)?/xi
|
34
|
+
@oct = /OCT(?:OBER)?/xi
|
35
|
+
@nov = /NOV(?:EMBER)? /xi
|
36
|
+
@dec = /DEC(?:EMBER)? /xi
|
36
37
|
|
37
38
|
uniupdate!
|
38
39
|
end
|
39
40
|
|
41
|
+
# Sets @month_txt which is a compound of all month regexps and matches any month name
|
42
|
+
def unimonth!
|
43
|
+
all_months_txt_rxs = MONTHS.map { |m| instance_variable_get("@#{m}".to_sym) }.join('|')
|
44
|
+
@month_txt = Regexp.new("(?<month>#{all_months_txt_rxs})", true)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Sets @formats which is an array of regexps used in succession to match and identify parts of the dates
|
40
48
|
def uniformats!
|
41
49
|
@formats = [
|
42
|
-
#
|
50
|
+
# Formats with a 4-digits year
|
51
|
+
# 14.4.1965, 14/04/1965, 14-4-1965, 14 04 1965, …
|
43
52
|
/\A\s* #{@day} #{@dlm} #{@month_num} #{@dlm} #{@year} \s*\z/xi,
|
44
53
|
|
45
|
-
# 14-APRIL-1965, 14-apr-
|
54
|
+
# 14-APRIL-1965, 14-apr-1965, 14/Apr/1965, …
|
46
55
|
/\A\s* #{@day} #{@dlm} #{@month_txt} #{@dlm} #{@year} \s*\z/xi,
|
47
56
|
|
48
|
-
# April 1965, apr.1965,
|
57
|
+
# April 1965, apr.1965, …
|
49
58
|
/\A\s* #{@month_txt} #{@dlm} #{@year} \s*\z/xi,
|
50
59
|
|
51
|
-
#
|
60
|
+
# Same formats with a 2-digits year
|
61
|
+
# 13.12.05, 13/12/05, 13-12-05, …
|
62
|
+
/\A\s* #{@day} #{@dlm} #{@month_num} #{@dlm} #{@year2} \s*\z/xi,
|
63
|
+
|
64
|
+
# April, DECEMBER, sep., …
|
52
65
|
/\A\s* #{@month_txt} \s*\z/xi,
|
53
66
|
]
|
54
67
|
end
|
55
68
|
|
56
|
-
|
57
|
-
all_months_txt_rxs = MONTHS.map { |m| instance_variable_get("@#{m}".to_sym) }.join('|')
|
58
|
-
@month_txt = Regexp.new("(?<month>#{all_months_txt_rxs})", true)
|
59
|
-
end
|
60
|
-
|
69
|
+
# A single method to update all compound matchers when a part matcher was changed
|
61
70
|
def uniupdate!
|
62
71
|
unimonth!
|
63
72
|
uniformats!
|
64
73
|
end
|
65
74
|
|
75
|
+
# Batch-define setters for date part matchers (listed in AUTOUPDATE) that, when set,
|
76
|
+
# automatically update the compound matchers (listed in COMPOUND)
|
77
|
+
AUTOUPDATE.each do |var|
|
78
|
+
# def jan=(regexp)
|
79
|
+
# return regexp if @jan == regexp
|
80
|
+
# @jan = regexp
|
81
|
+
# uniupdate!
|
82
|
+
# end
|
83
|
+
define_method("#{var}=".to_sym) do |regexp|
|
84
|
+
var_name = "@#{var}".to_sym
|
85
|
+
return regexp if instance_variable_get(var_name) == regexp
|
86
|
+
instance_variable_set(var_name, regexp)
|
87
|
+
uniupdate!
|
88
|
+
end
|
89
|
+
end
|
66
90
|
end
|
67
91
|
|
92
|
+
# Quando's class-level configuration
|
68
93
|
# @return [Quando::Config]
|
69
94
|
def self.config
|
70
95
|
@config ||= Config.new
|
71
96
|
end
|
72
97
|
|
98
|
+
# @return [Quando::Config]
|
73
99
|
def self.configure
|
74
100
|
config unless @config
|
75
101
|
yield(config) if block_given?
|
102
|
+
@config
|
76
103
|
end
|
77
104
|
|
105
|
+
# Reset Quando's class-level configuration to defaults
|
106
|
+
# @return [Quando::Config]
|
78
107
|
def self.reset!
|
79
108
|
@config = Config.new
|
80
109
|
end
|
data/lib/quando/parser.rb
CHANGED
@@ -48,7 +48,7 @@ module Quando
|
|
48
48
|
return unless found?(:year)
|
49
49
|
|
50
50
|
year = @date_parts[:year].to_i
|
51
|
-
year < 100 ? year +
|
51
|
+
year < 100 ? year + config.century : year
|
52
52
|
end
|
53
53
|
|
54
54
|
# @return [Integer, nil]
|
@@ -58,7 +58,7 @@ module Quando
|
|
58
58
|
|
59
59
|
month = @date_parts[:month]
|
60
60
|
|
61
|
-
if config.month_num.match(month)
|
61
|
+
month_num = if config.month_num.match(month)
|
62
62
|
month.to_i
|
63
63
|
else
|
64
64
|
month_index = Quando::Config::MONTHS.find_index do |month_name|
|
@@ -68,6 +68,8 @@ module Quando
|
|
68
68
|
|
69
69
|
month_index + 1 if month_index
|
70
70
|
end
|
71
|
+
|
72
|
+
month_num if (1..12).include?(month_num)
|
71
73
|
end
|
72
74
|
|
73
75
|
# @return [Integer, nil]
|
@@ -76,6 +78,7 @@ module Quando
|
|
76
78
|
return unless found?(:day)
|
77
79
|
|
78
80
|
day = @date_parts[:day].to_i
|
81
|
+
|
79
82
|
day if (1..31).include?(day)
|
80
83
|
end
|
81
84
|
|
data/lib/quando/version.rb
CHANGED
data/lib/quando.rb
CHANGED
@@ -7,8 +7,10 @@ require 'quando/parser'
|
|
7
7
|
|
8
8
|
module Quando
|
9
9
|
|
10
|
-
# @param opts [Hash]
|
11
10
|
# @param date [String]
|
11
|
+
# @param opts [Hash]
|
12
|
+
# @option opts [Regexp, Array<Regexp>] :matcher (nil)
|
13
|
+
# @option opts [Integer] :century (nil)
|
12
14
|
# @return [Date, nil]
|
13
15
|
def self.parse(date, opts = {})
|
14
16
|
return if (date = date.to_s.strip).empty?
|
@@ -21,6 +23,12 @@ module Quando
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
if opts[:century]
|
27
|
+
p.configure do |c|
|
28
|
+
c.century = opts[:century]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
24
32
|
p.parse(date)
|
25
33
|
end
|
26
34
|
|
data/quando.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quando
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Konotopov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,13 +79,16 @@ files:
|
|
79
79
|
- ".rspec"
|
80
80
|
- Gemfile
|
81
81
|
- Gemfile.lock
|
82
|
+
- LICENSE.md
|
82
83
|
- README.md
|
83
84
|
- Rakefile
|
85
|
+
- bin/console
|
84
86
|
- lib/quando.rb
|
85
87
|
- lib/quando/config.rb
|
86
88
|
- lib/quando/parser.rb
|
87
89
|
- lib/quando/version.rb
|
88
90
|
- quando.gemspec
|
91
|
+
- quando.png
|
89
92
|
homepage: https://github.com/kinkou/quando
|
90
93
|
licenses: []
|
91
94
|
metadata: {}
|
@@ -104,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: '0'
|
106
109
|
requirements: []
|
107
|
-
|
108
|
-
rubygems_version: 2.7.6
|
110
|
+
rubygems_version: 3.0.3
|
109
111
|
signing_key:
|
110
112
|
specification_version: 4
|
111
113
|
summary: Configurable date parser
|