Class: Timeliness::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/timeliness/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_formatObject

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_thresholdObject

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_typeObject

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_timezoneObject

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