Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Datetime

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/simple_html/sections/html_datetime.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Datetime

Returns a new instance of Html_Datetime.



14
15
16
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_datetime.rb', line 14

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hDatetime) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_datetime.rb', line 18

def writeHtml(hDatetime)

   date = hDatetime[:dateTime]
   dateRes = hDatetime[:dateResolution]
   dateStr = ''

   unless date.nil?
      case dateRes
         when 'Y', 'YM', 'YMD'
            dateStr = AdiwgDateTimeFun.stringDateFromDateTime(date, dateRes)
         else
            dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateRes)
      end
   end

   # datetime - return string
   dateStr.to_s

end