From 71162d5614b9b7c31db7b7b51bf6742210e3ff00 Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Mon, 11 Oct 2010 15:49:01 +1100 Subject: [PATCH] parser should be a module not a class --- lib/validates_timeliness/parser.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/validates_timeliness/parser.rb b/lib/validates_timeliness/parser.rb index 155dcc2..6c9ef8c 100644 --- a/lib/validates_timeliness/parser.rb +++ b/lib/validates_timeliness/parser.rb @@ -9,8 +9,8 @@ module ValidatesTimeliness # Formats can be added or removed to customize the set of valid date or time # string values. # - class Parser - cattr_reader :time_expressions, :date_expressions, :datetime_expressions + module Parser + mattr_reader :time_expressions, :date_expressions, :datetime_expressions # Set the threshold value for a two digit year to be considered last century # @@ -20,7 +20,7 @@ module ValidatesTimeliness # year = '29' is considered 2029 # year = '30' is considered 1930 # - cattr_accessor :ambiguous_year_threshold + mattr_accessor :ambiguous_year_threshold self.ambiguous_year_threshold = 30 # Format tokens: @@ -57,7 +57,7 @@ module ValidatesTimeliness # by the next lowest length valid repeating token (e.g. yyy will be # replaced with yy) - cattr_accessor :time_formats + mattr_accessor :time_formats @@time_formats = [ 'hh:nn:ss', 'hh-nn-ss', @@ -72,7 +72,7 @@ module ValidatesTimeliness 'h_ampm' ] - cattr_accessor :date_formats + mattr_accessor :date_formats @@date_formats = [ 'yyyy-mm-dd', 'yyyy/mm/dd', @@ -87,7 +87,7 @@ module ValidatesTimeliness 'd mmm yy' ] - cattr_accessor :datetime_formats + mattr_accessor :datetime_formats @@datetime_formats = [ 'yyyy-mm-dd hh:nn:ss', 'yyyy-mm-dd h:nn', @@ -111,7 +111,7 @@ module ValidatesTimeliness # All tokens available for format construction. The token array is made of # regexp and key for format component mapping, if any. # - cattr_accessor :format_tokens + mattr_accessor :format_tokens @@format_tokens = { 'ddd' => [ '\w{3,9}' ], 'dd' => [ '\d{2}', :day ], @@ -143,7 +143,7 @@ module ValidatesTimeliness # If the position is nil, then the value won't be put in the time array. If the # code slot is empty, then just the raw value is used. # - cattr_accessor :format_components + mattr_accessor :format_components @@format_components = { :year => [ 0, 'unambiguous_year(year)'], :month => [ 1, 'month_index(month)'],