Sha256: 58fed6aabe528743e06ff8a5bc675be6633ddb663649fbf88d7eee6da2086390

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

require 'date'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/date/acts_like'
require 'active_support/core_ext/date/conversions'
require 'active_support/core_ext/time/acts_like'
require 'active_support/core_ext/time/conversions'
require 'active_support/core_ext/date_time/acts_like'
require 'active_support/core_ext/date_time/conversions'

module ValidatesTimeliness
  autoload :Parser,  'validates_timeliness/parser'
  autoload :VERSION, 'validates_timeliness/version'

  # Add plugin to supported ORMs (only :active_record for now)
  mattr_accessor :extend_orms
  @@extend_orms = [ defined?(ActiveRecord) && :active_record ].compact

  # User the plugin date/time parser which is stricter and extendable
  mattr_accessor :use_plugin_parser
  @@use_plugin_parser = false

  # Default timezone
  mattr_accessor :default_timezone
  @@default_timezone = defined?(ActiveRecord) ? ActiveRecord::Base.default_timezone : :utc

  # Set the dummy date part for a time type values.
  mattr_accessor :dummy_date_for_time_type
  @@dummy_date_for_time_type = [ 2000, 1, 1 ]

  # Ignore errors when restriction options are evaluated
  mattr_accessor :ignore_restriction_errors
  @@ignore_restriction_errors = defined?(Rails) ? !Rails.env.test? : false

  # Shorthand time and date symbols for restrictions
  mattr_accessor :restriction_shorthand_symbols
  @@restriction_shorthand_symbols = {
    :now   => lambda { Time.now },
    :today => lambda { Date.today }
  }

  # Setup method for plugin configuration
  def self.setup
    yield self
    extend_orms.each {|orm| require "validates_timeliness/orms/#{orm}" }
  end
end

require 'validates_timeliness/conversion'
require 'validates_timeliness/validator'
require 'validates_timeliness/helper_methods'
require 'validates_timeliness/attribute_methods'
require 'validates_timeliness/extensions'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validates_timeliness-3.0.0.beta.2 lib/validates_timeliness.rb