Class: Hanami::Model::Plugins::Timestamps::InputWithTimestamp Private
- Inherits:
-
WrappingInput
- Object
- WrappingInput
- Hanami::Model::Plugins::Timestamps::InputWithTimestamp
- Defined in:
- lib/hanami/model/plugins/timestamps.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Takes the input and applies the timestamp transformation. This is an “abstract class”, please look at the subclasses for specific behaviors.
Direct Known Subclasses
Constant Summary collapse
- TIMESTAMPS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Conventional timestamp names
%i[created_at updated_at].freeze
Instance Method Summary collapse
-
#[](value) ⇒ Object
private
Processes the input.
-
#initialize(relation, input) ⇒ InputWithTimestamp
constructor
private
A new instance of InputWithTimestamp.
Constructor Details
#initialize(relation, input) ⇒ InputWithTimestamp
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of InputWithTimestamp.
26 27 28 29 |
# File 'lib/hanami/model/plugins/timestamps.rb', line 26 def initialize(relation, input) super @timestamps = relation.columns & TIMESTAMPS end |
Instance Method Details
#[](value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Processes the input
35 36 37 38 39 |
# File 'lib/hanami/model/plugins/timestamps.rb', line 35 def [](value) return @input[value] unless _touch(@input[value], Time.now) end |