Sha256: e568c24018093dd594fe6ce9f44d841a97c0ce89a5afe82799efd59e98992aca

Contents?: true

Size: 500 Bytes

Versions: 3

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

require 'date'

Date.class_eval do
  # @return [String] - mm/dd/yyyy or m/d/yy
  def display_user(all = false)
    strftime(all ? '%m/%d/%Y' : '%-m/%-d/%y')
  end
end

DateTime.class_eval do
  # @return [String] - mm/dd/yyyy or m/d/yy
  def display_user(all = false)
    strftime(all ? '%m/%d/%Y %r' : '%-m/%-d/%y %r')
  end
end

Time.class_eval do
  # @return [String] - mm/dd/yyyy or m/d/yy
  def display_user(all = false)
    to_datetime.display_user(all)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
display_user_extension-0.1.0 lib/display_user_extension.rb
display_user_extension-1.0.1 lib/display_user_extension.rb
display_user_extension-1.0.1.pre.rc.1 lib/display_user_extension.rb