Class: Timeliness::Configuration
- Inherits:
-
Object
- Object
- Timeliness::Configuration
- Defined in:
- lib/timeliness/configuration.rb
Instance Attribute Summary collapse
-
#ambiguous_date_format ⇒ Object
Default parsing of ambiguous date formats.
-
#ambiguous_year_threshold ⇒ Object
Set the threshold value for a two digit year to be considered last century.
-
#date_for_time_type ⇒ Object
Set the default date part for a time type values.
-
#default_timezone ⇒ Object
Default timezone.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
33 34 35 36 37 38 |
# File 'lib/timeliness/configuration.rb', line 33 def initialize @default_timezone = :local @date_for_time_type = lambda { Time.now } @ambiguous_date_format = :us @ambiguous_year_threshold = 30 end |
Instance Attribute Details
#ambiguous_date_format ⇒ Object
Default parsing of ambiguous date formats. Options:
- :us (default, 01/02/2000 = 2nd of January 2000)
- :euro (01/02/2000 = 1st of February 2000)
21 22 23 |
# File 'lib/timeliness/configuration.rb', line 21 def ambiguous_date_format @ambiguous_date_format end |
#ambiguous_year_threshold ⇒ Object
Set the threshold value for a two digit year to be considered last century
Default: 30
Example:
year = '29' is considered 2029
year = '30' is considered 1930
31 32 33 |
# File 'lib/timeliness/configuration.rb', line 31 def ambiguous_year_threshold @ambiguous_year_threshold end |
#date_for_time_type ⇒ Object
Set the default date part for a time type values.
15 16 17 |
# File 'lib/timeliness/configuration.rb', line 15 def date_for_time_type @date_for_time_type end |
#default_timezone ⇒ Object
Default timezone. Options:
- :local (default)
- :utc
If ActiveSupport loaded, also
- :current
- 'Zone name'
11 12 13 |
# File 'lib/timeliness/configuration.rb', line 11 def default_timezone @default_timezone end |