module RenderHelper

Public Instance Methods

as_rfc3339(published, updated = nil) click to toggle source
# File lib/msgtrail/renderers.rb, line 3
def as_rfc3339(published, updated = nil)
  updated.nil? ? datestamp = published : datestamp = updated
  ymd = datestamp[:date].split(/\D/).map(&:to_i)
  hm  = datestamp[:time].split(/\D/).map(&:to_i)
  DateTime.new(ymd[0], ymd[1], ymd[2], hm[0], hm[1], 0, datestamp[:utc_offset]).rfc3339
end
now_as_rfc3339() click to toggle source
# File lib/msgtrail/renderers.rb, line 10
def now_as_rfc3339
  DateTime.now.rfc3339
end
titlecase(word) click to toggle source
# File lib/msgtrail/renderers.rb, line 14
def titlecase(word)
  return if word.to_s.strip.empty?
  Nice.title(word)
end
xml_safe(str) click to toggle source
# File lib/msgtrail/renderers.rb, line 19
def xml_safe(str)
  ERB::Util.h(str)
end