Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/works_cited/extensions/time.rb

Overview

WorksCited extensions to Time

Instance Method Summary collapse

Instance Method Details

#mla_dateObject



5
6
7
8
9
10
# File 'lib/works_cited/extensions/time.rb', line 5

def mla_date
  month_name = strftime('%B')
  return strftime('%e %B %Y') if month_name.length < 5

  strftime('%e %b. %Y')
end

#mla_datetimeObject



12
13
14
15
16
17
18
19
20
# File 'lib/works_cited/extensions/time.rb', line 12

def mla_datetime
  month_name = strftime('%B')
  time = if month_name.length < 5
           strftime('%e %B %Y, %l:%M %P')
         else
           strftime('%e %b. %Y, %l:%M %P')
         end
  time.gsub(/([ap])m/, '\\1.m.')
end