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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGQxMjM3N2VjYzczYTFmOGNhMjUxOTQ4ZGZmZWMyMjg2OTQ5YzNhZg==
4
+ YjM4M2JjZmJiOGEyNDY1MDhlMDQxZTM1YTc2NGJiN2U5MTllMmZiOQ==
5
5
  data.tar.gz: !binary |-
6
- ZTRiY2FkYWFjYzVhOWQyY2EzNTdhMzAzMGE1NDFlNmFjMjdjNjVkYg==
6
+ OGMxNjlhYWQwYTBhNTQyZDczMzkwMjFjZjZhYTU1NjI3MzAzNzNhOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OWU0ODM0ZDE1Y2IxMjI0YmU1NTE4M2JiZTY2ZTZlZTlhMjZhZTc1MmU2Njkw
10
- YzJlYmE1MThkMGIzYjhkYzg0NWRkYjA2ZDdiMWZlNjY0Yzk5MWZjMDlmYWIz
11
- YmJkZjY1NzM4OTUxMTIyNDc1NTkxNTM4ZGZhMTE3NWI0YWIxMjY=
9
+ YmQ4N2RmNjJmNTI2M2U2Y2U1YTA1MWY2MzNiNjJjMTc3NmMyMjY1MGY5ZTAz
10
+ NDNhOWE1YWRjZTE0MmM1ODg4ZjU0MzU0YTU1NGMzMWEwYzgzMmJlNmE1ZjVi
11
+ MzI0MTEyYzRiZDFjMDM5ZTcwZTU1MDE5MDMyNDc0ODJjMjhlNjM=
12
12
  data.tar.gz: !binary |-
13
- N2NiNzNiMzg5ZmVkOWJiODk1YTY4Njg3MTU3NGZlMTkxNDY5NjE5M2E3NDBl
14
- MzVkYmYyZTYyNjRhYjNlZWFlZmNkNmQ3MTVjMTQ0OWM0OTUzYWJmMjFlMzlk
15
- NDZiM2FjNTIwMjVjMjE4MGU2OGY1YzQwNDFjMDczZjQ5N2Q4OGY=
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
- mattr_writer :delimiter, :date_format
7
-
8
- DEFAULT_DELIMITER = "/|-"
6
+ mattr_accessor :delimiter do
7
+ "[/|-]{1}"
8
+ end
9
9
 
10
- def self.delimiter
11
- DEFAULT_DELIMITER
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
- def self.date_format
15
- @date_format ||= %r{\d{1,2}#{delimiter}\d{1,2}#{delimiter}\d{2,4}}
14
+ mattr_accessor :date_format do
15
+ @date_format ||= default_format
16
16
  end
17
17
 
18
18
  def parse_as_americanized_date(*attributes)
@@ -1,3 +1,3 @@
1
1
  module AmericanDateParsing
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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.1
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-02-14 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic