age_calc 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/age_calc.rb +12 -0
  3. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fef845544dc2989738d400e02f6871f0b8b18403
4
+ data.tar.gz: 494eb2160053e5510e4d6ab9c96f30dc72f6f51b
5
+ SHA512:
6
+ metadata.gz: 36351831380df77e10b7406aa1b3730b6546b341ef963a4c68e5622e6955fb64d2d67d9326f80673daea955bebe3d426eabb4fb3dd8800a2e5ea4c830b838185
7
+ data.tar.gz: f6f7c649f9b063ce83ea484ae694c0de32c1584a8fee0fdf0a0ad9d782b1562c855f5032aca71e53377178f31a96c0578dc06607947d3212c60799b678863994
@@ -0,0 +1,12 @@
1
+ module AgeCalculator
2
+
3
+ def self.age_calc(birthday)
4
+ years = Date.today.year - birthday.year
5
+ if Date.today.month < birthday.month
6
+ years -= 1
7
+ elsif Date.today.month == birthday.month && Date.today.day < birthday.day
8
+ years -= 1
9
+ end
10
+ years
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: age_calc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Simon Brady
8
+ - S.B.
9
+ - Caitlin Prentke
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2017-08-24 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: Uses datetime to easily calculate age
16
+ email: caitlinprentke@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/age_calc.rb
22
+ homepage:
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.6.11
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Calculates age in Ruby
46
+ test_files: []