Sha256: 54f0c02432f0a99b2d98aa9fbecf2ba6dabec072c980d5a184ac0cb52dbeb76f

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 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.is_a?(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?

    x.to_s.gsub(/\r*\n/, '<br/>')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rows_controller-3.0.1 lib/rows/utils.rb