Class: Etcher::Transformers::Time
- Inherits:
-
Object
- Object
- Etcher::Transformers::Time
- Defined in:
- lib/etcher/transformers/time.rb
Overview
Conditionally transforms current time for key.
Instance Method Summary collapse
- #call(attributes) ⇒ Object
-
#initialize(key, fallback: ::Time.now.utc) ⇒ Time
constructor
A new instance of Time.
Constructor Details
#initialize(key, fallback: ::Time.now.utc) ⇒ Time
Returns a new instance of Time.
11 12 13 14 |
# File 'lib/etcher/transformers/time.rb', line 11 def initialize key, fallback: ::Time.now.utc @key = key @fallback = fallback end |
Instance Method Details
#call(attributes) ⇒ Object
16 17 18 19 |
# File 'lib/etcher/transformers/time.rb', line 16 def call attributes attributes.fetch(key) { attributes.merge! key => fallback } Success attributes end |