Sha256: 1c295ccdf1d8296c3c7a495597c7e00d9fc35d36b0f1a9ddbd0ac268716a0ad6

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'date'
require 'forwardable'

require 'timeliness/helpers'
require 'timeliness/definitions'
require 'timeliness/format'
require 'timeliness/format_set'
require 'timeliness/parser'
require 'timeliness/version'

module Timeliness
  class << self
    extend Forwardable
    def_delegators Parser, :parse, :_parse
    def_delegators Definitions, :add_formats, :remove_formats, :use_us_formats, :use_euro_formats
    attr_accessor :default_timezone, :date_for_time_type, :ambiguous_year_threshold
  end

  # Default timezone. Options:
  #   - :local (default)
  #   - :utc
  #   
  #   If ActiveSupport loaded, also
  #   - :current
  #   - 'Zone name'
  #
  self.default_timezone = :local

  # Set the default date part for a time type values.
  #
  self.date_for_time_type = lambda { Time.now }

  # 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
  #
  self.ambiguous_year_threshold = 30
end

Timeliness::Definitions.compile_formats

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
timeliness-0.3.10 lib/timeliness.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/timeliness-0.3.8/lib/timeliness.rb
timeliness-0.3.8 lib/timeliness.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/timeliness-0.3.7/lib/timeliness.rb
timeliness-0.3.7 lib/timeliness.rb