Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/american_date.rb

Overview

Modify parsing methods to handle american date format correctly.

Constant Summary collapse

AMERICAN_DATE_RE =

American date format detected by the library.

eval('%r_(?<!\d)(\d{1,2})/(\d{1,2})/(\d{4}|\d{2})(?!\d)_').freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._parse(string, comp = true) ⇒ Object

Transform american dates into ISO dates before parsing.



16
17
18
# File 'lib/american_date.rb', line 16

def _parse(string, comp=true)
  _parse_without_american_date(convert_american_to_iso(string), comp)
end

._parse_without_american_dateObject

Alias for stdlib Date._parse



13
# File 'lib/american_date.rb', line 13

alias _parse_without_american_date _parse

Instance Method Details

#parse(string, comp = true) ⇒ Object

Transform american dates into ISO dates before parsing.



25
26
27
# File 'lib/american_date.rb', line 25

def parse(string, comp=true)
  parse_without_american_date(convert_american_to_iso(string), comp)
end

#parse_without_american_dateObject

Alias for stdlib Date.parse



22
# File 'lib/american_date.rb', line 22

alias parse_without_american_date parse