duffy 0.2.3 → 0.2.4

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: 96eeac69472d545eb850cd92b52896f386a82ee6
4
- data.tar.gz: 1b2ff4d0e8628918f2cab3080da6b14da94579be
3
+ metadata.gz: d01359db9f3ec823f91ff534d3870712e0bcc599
4
+ data.tar.gz: c7b30c4d7e0ae05db21a0eaa335e3765c3d349f7
5
5
  SHA512:
6
- metadata.gz: 374da46815f90ac5b63501bb74e89bf296fa69c46360c4c8a01f191879239fdc8823bd6fa91399fc8e727ab0b9223597574da84aedce87fec5203f6a75bde2b6
7
- data.tar.gz: ab58ee610db03e93da864b2419f1cbb1aab9bb20482d62db51bc464322273241a06f9293a17ae7b6e938c3a846b723133a2d879339ca33146f295a814423ed00
6
+ metadata.gz: 51b4dee46a3905df6e1681a6724141842f258a14bbd3fe9e303d69f743c55680a9f855bfca5f12869bb81d9fdd75b16826a04b3a1cabf008118924cfc19e5375
7
+ data.tar.gz: 954f4d3b21b9b4a73e7c73b02c5cbde845988046486aaa21a5b721e552ff754f0ca3a89adc33f3c25aa50858c114e1df45487717f128f12cdbf03e6a8da1cea4
data/README.md CHANGED
@@ -25,7 +25,6 @@ String Patches:
25
25
 
26
26
  Method | Example | Output
27
27
  ------------------|-----------------|-------
28
- date! | "2014-07-16" | #< Date: 2015-07-16 >
29
28
  md5 | "duffy" | "904bc6e21e4799ce276200117215b88b"
30
29
  md5sum | "duffy" | "904bc6e21e4799ce276200117215b88b"
31
30
  to_ssn | "123456789" | "123-45-6789"
@@ -44,7 +43,6 @@ Date Patches:
44
43
 
45
44
  Method | Example | Output
46
45
  ------------------|-----------------|-------
47
- date! | Date.today | self
48
46
  fiscal_year | Date.today | 2015 (See config to set your organization's fiscal year start.)
49
47
 
50
48
 
@@ -52,7 +50,7 @@ NilClass Patches:
52
50
 
53
51
  Method | Example | Output
54
52
  ------------------|-----------------|-------
55
- date! | nil | self (Exists so you can call .date! on Date, String or nil
53
+ to_date | nil | self (Exists so you can call .to_date on Date, String or nil
56
54
 
57
55
 
58
56
  Active Record Aliases:
data/lib/duffy/date.rb CHANGED
@@ -7,13 +7,10 @@ class Date
7
7
  (self < Date.new(year, Duffy.configuration.fiscal_month, Duffy.configuration.fiscal_day)) ? year : year + 1
8
8
  end
9
9
 
10
- def date!
11
- self
12
- end
13
10
  end
14
11
 
15
12
  class NilClass
16
- def date!
13
+ def to_date
17
14
  self
18
15
  end
19
16
  end
data/lib/duffy/string.rb CHANGED
@@ -1,12 +1,6 @@
1
1
  # Monkey Patch String adding useful methods.
2
2
  class String
3
3
 
4
- # Cast a String to Date
5
- def date!
6
- Date.parse(self)
7
- end
8
-
9
-
10
4
  # Easier way to calculate the md5sum of a string.
11
5
  def md5
12
6
  Digest::MD5.hexdigest(self)
data/lib/duffy/version.rb CHANGED
@@ -1,3 +1,6 @@
1
1
  module Duffy
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
4
+
5
+ # History
6
+ # 0.2.4 - Added NilClass.to_date => nil
data/lib/duffy.rb CHANGED
@@ -8,7 +8,7 @@ require 'digest'
8
8
  if defined?(Rails)
9
9
  require File.dirname(__FILE__) + "/duffy/engine"
10
10
  require File.dirname(__FILE__) + "/duffy/railtie"
11
- require File.dirname(__FILE__) + "/duffy/active_record"
11
+ require File.dirname(__FILE__) + "/duffy/active_record" if defined?(ActiveRecord)
12
12
  end
13
13
 
14
14
  # Normal Requirements
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+ describe NilClass do
3
+
4
+ describe "to_date" do
5
+ it "returns nil" do
6
+ nil.to_date.should == nil
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Duffy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -106,6 +106,7 @@ files:
106
106
  - lib/duffy/version.rb
107
107
  - spec/date_spec.rb
108
108
  - spec/git_spec.rb
109
+ - spec/nilclass_spec.rb
109
110
  - spec/spec_helper.rb
110
111
  - spec/string_spec.rb
111
112
  - spec/system_spec.rb
@@ -138,6 +139,7 @@ summary: Library of things
138
139
  test_files:
139
140
  - spec/date_spec.rb
140
141
  - spec/git_spec.rb
142
+ - spec/nilclass_spec.rb
141
143
  - spec/spec_helper.rb
142
144
  - spec/string_spec.rb
143
145
  - spec/system_spec.rb