module MediServ::API::Format

Public Instance Methods

fmt_amount(n) click to toggle source
# File lib/mediserv/api/format.rb, line 11
def fmt_amount(n)
  n ? sprintf('%0.2f', n) : '0.00'
end
fmt_date(d) click to toggle source
# File lib/mediserv/api/format.rb, line 3
def fmt_date(d)
  d ? d.strftime('%d.%m.%Y') : ''
end
fmt_string(s, max: nil) click to toggle source
# File lib/mediserv/api/format.rb, line 15
def fmt_string(s, max: nil)
  max ? s[0..max] : s
end
fmt_time(t) click to toggle source
# File lib/mediserv/api/format.rb, line 7
def fmt_time(t)
  t ? t.strftime('%H:%M') : ''
end