Sha256: 793a7602e1ba959734cf2a725ce8dd733c23a2adc97c1ece21a5dc5b2eb8a61c

Contents?: true

Size: 655 Bytes

Versions: 4

Compression:

Stored size: 655 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'.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

4 entries across 4 versions & 1 rubygems

Version Path
rows_controller-2.0.8 lib/rows/utils.rb.bak
rows_controller-2.0.7 lib/rows/utils.rb
rows_controller-2.0.5 lib/rows/utils.rb
rows_controller-2.0.3 lib/rows_controller/utils.rb