power-age 1.0.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.
- checksums.yaml +7 -0
- data/README.md +40 -0
- data/age.rb +19 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8514b970f16a52230de0515a0c029315d4100951
|
4
|
+
data.tar.gz: '09e7ef32716c0c2638db590fba77e37dc6af4f63'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 85c8805ebd44294f14ec76a59556145fe2a45eb3b903afbac5f88a61e75ea62bbe53432e7482c9d946f9f73da5a9f4641d8d5f2cd5b363231eaa6f85088e329f
|
7
|
+
data.tar.gz: 4dc3f7cbb5dc2a99b72082fe4aa48ef05b9feaa27ab58c54681aebc741e05a09ec136930807e3677de3d854b02eb9d7ad91e1fc659ffc1eba175080c9deffeeb
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Age
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'power-age'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install power-age
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### `Age#new(timestamp)`
|
22
|
+
`Age#new` accepts a Time, Date or DateTime object as argument.
|
23
|
+
|
24
|
+
### `Age#now`
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
birthday = Time.new(1990, 3, 14)
|
28
|
+
Age.new(birthday).now
|
29
|
+
```
|
30
|
+
|
31
|
+
### `Age#at(timestamp)`
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
User = Struct.new(:dob)
|
35
|
+
Event = Struct.new(:start_date)
|
36
|
+
event = Event.new(Time.new(2020, 2, 20))
|
37
|
+
user = User.new(Time.new(1970, 6, 21))
|
38
|
+
|
39
|
+
Age.new(user.dob).at event.start_date
|
40
|
+
```
|
data/age.rb
ADDED
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: power-age
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Melchert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A handy little age calculation class
|
14
|
+
email: kevin.melchert@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- README.md
|
20
|
+
- age.rb
|
21
|
+
homepage:
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- "."
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.6.11
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Age Calculator
|
44
|
+
test_files: []
|