Class: Simplepay::Support::Epoch
- Inherits:
-
Object
- Object
- Simplepay::Support::Epoch
- Defined in:
- lib/simplepay/support/epoch.rb
Overview
Acts as a Simplepay::Support::Field :class
delegator.
This class provides a means to have Time values returned as an integer since epoch (January 1, 1970).
Instance Method Summary collapse
-
#initialize(time) ⇒ Epoch
constructor
A new instance of Epoch.
-
#to_s ⇒ Object
Returns a String of Integers, representing seconds since epoch.
Constructor Details
#initialize(time) ⇒ Epoch
Returns a new instance of Epoch.
12 13 14 |
# File 'lib/simplepay/support/epoch.rb', line 12 def initialize(time) @value = time ? parse(time) : Time.now end |
Instance Method Details
#to_s ⇒ Object
Returns a String of Integers, representing seconds since epoch.
19 20 21 |
# File 'lib/simplepay/support/epoch.rb', line 19 def to_s @value.to_i.to_s end |