american_date_parsing 0.0.1 → 0.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.
- checksums.yaml +8 -8
- data/README.md +8 -0
- data/lib/american_date_parsing.rb +7 -7
- data/lib/american_date_parsing/version.rb +1 -1
- data/test/american_date_parsing_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjM4M2JjZmJiOGEyNDY1MDhlMDQxZTM1YTc2NGJiN2U5MTllMmZiOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGMxNjlhYWQwYTBhNTQyZDczMzkwMjFjZjZhYTU1NjI3MzAzNzNhOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmQ4N2RmNjJmNTI2M2U2Y2U1YTA1MWY2MzNiNjJjMTc3NmMyMjY1MGY5ZTAz
|
10
|
+
NDNhOWE1YWRjZTE0MmM1ODg4ZjU0MzU0YTU1NGMzMWEwYzgzMmJlNmE1ZjVi
|
11
|
+
MzI0MTEyYzRiZDFjMDM5ZTcwZTU1MDE5MDMyNDc0ODJjMjhlNjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mzc1YWFkMTNkMDk5ZGFhNDI2YTM3OTQyMGUyZDkzODg5OTg2MTRkMDE2MzA0
|
14
|
+
NTg5NThiMjU5N2I2NDY5NTlhYTZlOGQ0OTFhMTFhYzRlM2Q5MDc2MzVhNDMz
|
15
|
+
NGI1ZGI2YTljZDBjYWRkNTQ3MGNkY2UyYTNhMjFiYzVlMDEwNjg=
|
data/README.md
CHANGED
@@ -105,3 +105,11 @@ en:
|
|
105
105
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
106
106
|
4. Push to the branch (`git push origin my-new-feature`)
|
107
107
|
5. Create new Pull Request
|
108
|
+
|
109
|
+
## About Foraker Labs
|
110
|
+
|
111
|
+
<img src="http://assets.foraker.com/foraker_logo.png" width="400" height="62">
|
112
|
+
|
113
|
+
This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.
|
114
|
+
|
115
|
+
Foraker Labs is a Boulder-based Ruby on Rails and iOS development shop. Please reach out if we can [help build your product](http://www.foraker.com).
|
@@ -3,16 +3,16 @@ require "active_support/core_ext"
|
|
3
3
|
require "chronic"
|
4
4
|
|
5
5
|
module AmericanDateParsing
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
mattr_accessor :delimiter do
|
7
|
+
"[/|-]{1}"
|
8
|
+
end
|
9
9
|
|
10
|
-
def self.
|
11
|
-
|
10
|
+
def self.default_format
|
11
|
+
@default_format ||= %r{\d{1,2}#{delimiter}\d{1,2}#{delimiter}\d{2,4}}
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
@date_format ||=
|
14
|
+
mattr_accessor :date_format do
|
15
|
+
@date_format ||= default_format
|
16
16
|
end
|
17
17
|
|
18
18
|
def parse_as_americanized_date(*attributes)
|
@@ -47,6 +47,14 @@ describe AmericanDateParsing do
|
|
47
47
|
errors("12252012").must_include('is invalid')
|
48
48
|
end
|
49
49
|
|
50
|
+
it "rejects dates with extraneous delimiters" do
|
51
|
+
errors("12/25//2012").must_include('is invalid')
|
52
|
+
end
|
53
|
+
|
54
|
+
it "rejects dates with missing delimiters" do
|
55
|
+
errors("12/252012").must_include('is invalid')
|
56
|
+
end
|
57
|
+
|
50
58
|
it "rejects nonsense dates" do
|
51
59
|
errors("cats").must_include('is invalid')
|
52
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: american_date_parsing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eddy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|