Class: QueryFilter::Utils::DateNormalizer
- Inherits:
-
Object
- Object
- QueryFilter::Utils::DateNormalizer
- Defined in:
- lib/query_filter/utils/date_normalizer.rb
Constant Summary collapse
- TIME_FORMAT =
'%Y-%m-%d %H:%M:%S'- PG_MIN_YEAR =
-4713
- PG_MAX_YEAR =
294276
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
-
#initialize(date, format) ⇒ DateNormalizer
constructor
A new instance of DateNormalizer.
- #normalize ⇒ Object
Constructor Details
#initialize(date, format) ⇒ DateNormalizer
Returns a new instance of DateNormalizer.
10 11 12 13 14 |
# File 'lib/query_filter/utils/date_normalizer.rb', line 10 def initialize(date, format) @date = date @format = format @parsed_value = parse end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/query_filter/utils/date_normalizer.rb', line 8 def date @date end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
8 9 10 |
# File 'lib/query_filter/utils/date_normalizer.rb', line 8 def format @format end |
Instance Method Details
#normalize ⇒ Object
16 17 18 |
# File 'lib/query_filter/utils/date_normalizer.rb', line 16 def normalize valid?(@parsed_value) ? @parsed_value : default_date end |