new_birthday 2.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/new_birthday.rb +10 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2181354c045bdc6054280c03d5c76358b868e97bdc821333b67a08cab307f87
4
+ data.tar.gz: ee7c4c699aff12d44afe42dfc2de281a23d7e5f24d659882dbdb5e92c95ea804
5
+ SHA512:
6
+ metadata.gz: d6f3ca92d43b7118599fb29b2db07666318cab70a689f6b5506d64390cfeb99e4109255dec03a97f05eefb6217bd21d3ea808415fcfefda267a9d22348e6ddc7
7
+ data.tar.gz: dcd22912c54cc2c9bb8fb6609946e2eb75cb46a4fc3a6a5c7834676e30937909309a99d8769aa86b271496de9012bf02c9890b762d32cd0535cc7e92dc2d54e8
@@ -0,0 +1,10 @@
1
+ require 'date'
2
+
3
+ class Birthday
4
+ def self.calculate_age(birthdate)
5
+ today = Date.today
6
+ age = today.year - birthdate.year
7
+ age -= 1 if today.yday < birthdate.yday
8
+ age
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: new_birthday
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hasbi Ash
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem provides a method to calculate the age of a person given their
14
+ birthdate.
15
+ email:
16
+ - muhasbiash07@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/new_birthday.rb
22
+ homepage:
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.3.7
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A simple gem to calculate age from a given birthday.
44
+ test_files: []