Module: DateAsString::Formats

Defined in:
lib/date_as_string/formats.rb

Defined Under Namespace

Classes: Format1, Format2, Format3, Format4, Format5

Class Method Summary collapse

Class Method Details

.find_format(format_string) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/date_as_string/formats.rb', line 3

def self.find_format(format_string)
  case format_string
  when :mm_dd_yyyy
    Format1
  when :mm_dd_yy
    Format2
  when :mmddyyyy
    Format3
  when :mmddyy
    Format4
  when :t_pmd
    Format5
  else
    raise TypeError.new("Format does not exist: #{format_string}")
  end
end