mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
Removing silly class variables from config module
This commit is contained in:
parent
2225c747e1
commit
5becd7886b
@ -24,26 +24,24 @@ module ValidatesTimeliness
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
delegate :default_timezone, :default_timezone=, :dummy_date_for_time_type, :dummy_date_for_time_type=, :to => Timeliness
|
delegate :default_timezone, :default_timezone=, :dummy_date_for_time_type, :dummy_date_for_time_type=, :to => Timeliness
|
||||||
|
|
||||||
|
attr_accessor :extend_orms, :ignore_restriction_errors, :restriction_shorthand_symbols, :use_plugin_parser
|
||||||
end
|
end
|
||||||
|
|
||||||
# Extend ORM/ODMs for full support (:active_record, :mongoid).
|
# Extend ORM/ODMs for full support (:active_record, :mongoid).
|
||||||
mattr_accessor :extend_orms
|
self.extend_orms = []
|
||||||
@@extend_orms = []
|
|
||||||
|
|
||||||
# Ignore errors when restriction options are evaluated
|
# Ignore errors when restriction options are evaluated
|
||||||
mattr_accessor :ignore_restriction_errors
|
self.ignore_restriction_errors = false
|
||||||
@@ignore_restriction_errors = false
|
|
||||||
|
|
||||||
# Shorthand time and date symbols for restrictions
|
# Shorthand time and date symbols for restrictions
|
||||||
mattr_accessor :restriction_shorthand_symbols
|
self.restriction_shorthand_symbols = {
|
||||||
@@restriction_shorthand_symbols = {
|
|
||||||
:now => lambda { Time.current },
|
:now => lambda { Time.current },
|
||||||
:today => lambda { Date.current }
|
:today => lambda { Date.current }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use the plugin date/time parser which is stricter and extensible
|
# Use the plugin date/time parser which is stricter and extensible
|
||||||
mattr_accessor :use_plugin_parser
|
self.use_plugin_parser = false
|
||||||
@@use_plugin_parser = false
|
|
||||||
|
|
||||||
# Default timezone
|
# Default timezone
|
||||||
self.default_timezone = :utc
|
self.default_timezone = :utc
|
||||||
@ -51,10 +49,6 @@ module ValidatesTimeliness
|
|||||||
# Set the dummy date part for a time type values.
|
# Set the dummy date part for a time type values.
|
||||||
self.dummy_date_for_time_type = [ 2000, 1, 1 ]
|
self.dummy_date_for_time_type = [ 2000, 1, 1 ]
|
||||||
|
|
||||||
def self.parser
|
|
||||||
Timeliness
|
|
||||||
end
|
|
||||||
|
|
||||||
# Setup method for plugin configuration
|
# Setup method for plugin configuration
|
||||||
def self.setup
|
def self.setup
|
||||||
yield self
|
yield self
|
||||||
@ -64,6 +58,8 @@ module ValidatesTimeliness
|
|||||||
def self.load_orms
|
def self.load_orms
|
||||||
extend_orms.each {|orm| require "validates_timeliness/orm/#{orm}" }
|
extend_orms.each {|orm| require "validates_timeliness/orm/#{orm}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.parser; Timeliness end
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'validates_timeliness/conversion'
|
require 'validates_timeliness/conversion'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user