add parser config to initializer

This commit is contained in:
Adam Meehan 2010-09-27 16:52:18 +10:00
parent 8b199b3f10
commit 5f31f40413
2 changed files with 16 additions and 0 deletions

View File

@ -22,4 +22,16 @@ ValidatesTimeliness.setup do |config|
# :now => lambda { Time.now },
# :today => lambda { Date.today }
# )
#
# Add one or more formats making them valid. e.g. add_formats(:date, 'd(st|rd|th) of mmm, yyyy')
# config.parser.add_formats()
#
# Remove one or more formats making them invalid. e.g. remove_formats(:date, 'dd/mm/yyy')
# config.parser.remove_formats()
#
# Change the amiguous year threshold when parsing a 2 digit year
# config.parser.ambiguous_year_threshold = 30
#
# Treat ambiguous dates, such as 01/02/1950, as a Non-US date.
# config.parser.remove_us_formats
end

View File

@ -39,6 +39,10 @@ module ValidatesTimeliness
:today => lambda { Date.today }
}
def self.parser
Parser
end
# Setup method for plugin configuration
def self.setup
yield self