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
[: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.
24 25 26 27 28 |
# File 'lib/hanami/model/plugins/timestamps.rb', line 24 def initialize(relation, input) super columns = relation.columns.sort @timestamps = (columns & TIMESTAMPS) == 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
34 35 36 37 |
# File 'lib/hanami/model/plugins/timestamps.rb', line 34 def [](value) return value unless _touch(@input[value], Time.now) end |