module Rubicure::Concerns::Util

utility methods

Public Instance Methods

to_date(arg) click to toggle source

@param arg [Date,Time,String]

@return [Date] arg is String, Date or Time @return [nil] arg is other

# File lib/rubicure/concerns/util.rb, line 9
def to_date(arg)
  case arg
  when Date
    arg
  when Time
    arg.to_date
  when String
    begin
      Date.parse(arg)
    rescue
      nil
    end
  else
    nil
  end
end