my_age 0.1.5 → 0.1.6

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: 3ee9d672d0e7be5563cae485a8a5e907933184b5
4
- data.tar.gz: 66160d875ba22993fbd1221a8fc9bcb810ce3f4e
3
+ metadata.gz: 94b8a543fa3af2693be174f088a77026200cdd2b
4
+ data.tar.gz: df31200e745181d457332916b91d86e519f2bab4
5
5
  SHA512:
6
- metadata.gz: b8bf412c95c275f4d8fcd7565680d3a77109fdd3359ba1008e0eb4f884c64877a3188391e09d8cbd5a01cff30e855c8d31715ef3367dd1a175dfa32573fbf419
7
- data.tar.gz: 9c17be6e120d2edf4b31e4a029039801245c87336c53dad9095d96c1feb5513569369ea2732f85231b9d5dd8501d562521c009f11065231267359e876809382d
6
+ metadata.gz: 1a6e30945d86c319f00c7c8ff9a4a7bcdb5c795fe2ff6c0619fb3dbc1b79e8897e58437b3362721da211412e84a78661b1737c2e65e4f866a99abfb83b1ac286
7
+ data.tar.gz: 51639941c07681e648f793eee0e16b21a5dfdc209ee4187ec7c1840b7618bff62c4c3c2ab0923b3b84f7617d8abc1692cb869175a16d32f253270ba759402de2
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MyAge
2
-
2
+ [![Build Status](https://travis-ci.org/ej2015/my_age.svg?branch=master)](https://travis-ci.org/ej2015/my_age)
3
+ [![CodeFactor](https://www.codefactor.io/repository/github/ej2015/my_age/badge)](https://www.codefactor.io/repository/github/ej2015/my_age)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/eba3926f39c9682e47ed/maintainability)](https://codeclimate.com/github/ej2015/my_age/maintainability)
3
5
  ## Installation
4
6
 
5
7
  Add this line to your application's Gemfile:
@@ -27,7 +27,7 @@ module MyAge
27
27
 
28
28
  private
29
29
  def date_to_int(date)
30
- date.strftime("%Y%m%d").to_i
30
+ date.strftime("%Y%m%d").to_i
31
31
  end
32
32
 
33
33
  def today
data/lib/my_age/cli.rb CHANGED
@@ -14,22 +14,24 @@ module MyAge
14
14
  puts self.age(date)
15
15
  end
16
16
 
17
-
18
17
  private
19
18
  def get_date(date)
20
19
  if date =~ /^\d{4}-\d{2}-\d{2}$/
21
20
  DateTime.strptime(date, "%Y-%m-%d")
22
21
  else
23
- dates = date.delete(")").split("(")
24
- if dates.length == 2
25
- Date.today.send(dates[0].to_sym, dates[1].to_i)
26
- else
27
- Date.today.send(dates[0].to_sym)
28
- end
22
+ date_from_active_support_core_ext_helper(date)
29
23
  end
30
24
  rescue NoMethodError
31
25
  Date.send(date)
32
26
  end
33
27
 
28
+ def date_from_active_support_core_ext_helper(date)
29
+ dates = date.delete(")").split("(")
30
+ method = dates[0].to_sym
31
+ arg = dates[1]
32
+ arg.nil? ? Date.today.send(method) :
33
+ Date.today.send(method, arg.to_i)
34
+ end
35
+
34
36
  end
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module MyAge
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_age
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar