Sha256: 31b133c1eb3802348db39ecfcb0284bf2ebb9048caf1d4e95d9d73d12e8a8c2c

Contents?: true

Size: 387 Bytes

Versions: 4

Compression:

Stored size: 387 Bytes

Contents

module Rubicure
  module Concerns
    module Util
      # @param arg
      # @return [Date] arg is String or Date
      # @return [Time] arg is Time
      # @return [nil] arg is other
      def to_date(arg)
        case arg
          when Date, Time
            arg
          when String
            Date.parse(arg)
          else
            nil
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubicure-0.0.7 lib/rubicure/concerns/util.rb
rubicure-0.0.6 lib/rubicure/concerns/util.rb
rubicure-0.0.5 lib/rubicure/concerns/util.rb
rubicure-0.0.4 lib/rubicure/concerns/util.rb