class Object

Constants

AMERICAN_DATE_RE

American date format detected by the library.

Public Instance Methods

_parse(string, comp=true) click to toggle source

Transform american dates into ISO dates before parsing.

   # File lib/american_date.rb
32 def _parse(string, comp=true)
33   _parse_without_american_date(convert_american_to_iso(string), comp)
34 end
Also aliased as: _parse_without_american_date
_parse_without_american_date(string, comp=true)

Alias for stdlib Date._parse

Alias for: _parse
convert_american_to_iso(string) click to toggle source

Transform american date fromat into ISO format.

   # File lib/american_date.rb
58 def convert_american_to_iso(string)
59   unless string.is_a?(String)
60     if string.respond_to?(:to_str)
61       str = string.to_str
62       unless str.is_a?(String)
63         raise TypeError, "no implicit conversion of #{string.inspect} into String"
64       end
65       string = str
66     else
67       raise TypeError, "no implicit conversion of #{string.inspect} into String"
68     end
69   end
70   string.sub(AMERICAN_DATE_RE){|m| "#$3-#$1-#$2"}
71 end
parse(string, comp=true, start=Date::ITALY) click to toggle source

Transform american dates into ISO dates before parsing.

   # File lib/american_date.rb
49 def parse(string, comp=true, start=Date::ITALY)
50   parse_without_american_date(convert_american_to_iso(string), comp, start)
51 end
Also aliased as: parse_without_american_date, parse_without_american_date
parse_without_american_date(string, comp=true, start=Date::ITALY)

Alias for stdlib Date.parse

Alias for: parse