Class: Realize::Value::Now
- Inherits:
-
Object
- Object
- Realize::Value::Now
- Defined in:
- lib/realize/value/now.rb
Overview
Return a current Time object.
Constant Summary collapse
- DEFAULT_UTC_OFFSET =
'+00:00'
Instance Attribute Summary collapse
-
#utc_offset ⇒ Object
readonly
Returns the value of attribute utc_offset.
Instance Method Summary collapse
-
#initialize(utc_offset: DEFAULT_UTC_OFFSET) ⇒ Now
constructor
A new instance of Now.
- #transform(_resolver, _value, _time, _record) ⇒ Object
Constructor Details
#initialize(utc_offset: DEFAULT_UTC_OFFSET) ⇒ Now
Returns a new instance of Now.
20 21 22 23 24 |
# File 'lib/realize/value/now.rb', line 20 def initialize(utc_offset: DEFAULT_UTC_OFFSET) @utc_offset = utc_offset || DEFAULT_UTC_OFFSET freeze end |
Instance Attribute Details
#utc_offset ⇒ Object (readonly)
Returns the value of attribute utc_offset.
18 19 20 |
# File 'lib/realize/value/now.rb', line 18 def utc_offset @utc_offset end |
Instance Method Details
#transform(_resolver, _value, _time, _record) ⇒ Object
26 27 28 |
# File 'lib/realize/value/now.rb', line 26 def transform(_resolver, _value, _time, _record) Time.now.utc.localtime(utc_offset) end |