Module: Mpp::Expires
- Extended by:
- T::Sig
- Defined in:
- lib/mpp/expires.rb
Class Method Summary collapse
- .days(n) ⇒ Object
- .hours(n) ⇒ Object
- .minutes(n) ⇒ Object
- .months(n) ⇒ Object
- .seconds(n) ⇒ Object
- .to_iso(time) ⇒ Object
- .weeks(n) ⇒ Object
- .years(n) ⇒ Object
Class Method Details
.days(n) ⇒ Object
38 39 40 |
# File 'lib/mpp/expires.rb', line 38 def days(n) to_iso(Time.now.utc + (n * 86_400)) end |
.hours(n) ⇒ Object
32 33 34 |
# File 'lib/mpp/expires.rb', line 32 def hours(n) to_iso(Time.now.utc + (n * 3600)) end |
.minutes(n) ⇒ Object
26 27 28 |
# File 'lib/mpp/expires.rb', line 26 def minutes(n) to_iso(Time.now.utc + (n * 60)) end |
.months(n) ⇒ Object
50 51 52 |
# File 'lib/mpp/expires.rb', line 50 def months(n) to_iso(Time.now.utc + (n * 30 * 86_400)) end |
.seconds(n) ⇒ Object
20 21 22 |
# File 'lib/mpp/expires.rb', line 20 def seconds(n) to_iso(Time.now.utc + n) end |
.to_iso(time) ⇒ Object
14 15 16 |
# File 'lib/mpp/expires.rb', line 14 def to_iso(time) time.utc.strftime("%Y-%m-%dT%H:%M:%S.%LZ") end |
.weeks(n) ⇒ Object
44 45 46 |
# File 'lib/mpp/expires.rb', line 44 def weeks(n) to_iso(Time.now.utc + (n * 7 * 86_400)) end |
.years(n) ⇒ Object
56 57 58 |
# File 'lib/mpp/expires.rb', line 56 def years(n) to_iso(Time.now.utc + (n * 365 * 86_400)) end |