Sha256: a4b0275113e6178a239047c22a41a82c827f83f4bb38ef8d20eb75b38b2b1796
Contents?: true
Size: 715 Bytes
Versions: 7
Compression:
Stored size: 715 Bytes
Contents
module Rows::Utils # formatting def resource_format(x) return '--'.html_safe if x.nil? bool = x.class == Time || x.class == Date || x.class == DateTime || x.class == ActiveSupport::TimeWithZone return x.strftime('%d.%m.%Y').html_safe if bool # return I18n.l(x) if bool # return x.to_s.html_safe if x.class == Fixnum return x.to_s.html_safe if x.kind_of?(Integer) return 'X'.html_safe if x.class == TrueClass return ' '.html_safe if x.class == FalseClass return x.call if x.class == Proc return '---'.html_safe if x.empty? str = x.to_s return str.gsub(/\r*\n/, '<br/>') end end
Version data entries
7 entries across 7 versions & 1 rubygems