Files

DateAndTimeFormatting::ClassMethods

Public Instance Methods

add_format(key, format) click to toggle source

Adds a date and time format

Because this operation is not thread safe, you should define custom formats when you load you application. The recommended way to do that, is to use the before_app_loads bootloader.

If you want to add a format at runtime, you will need to use a mutex and synchronize it yourself.

Parameters

key

name of the format

format

time format to use

Returns

Hash

a hash with all formats available

Example

  Merb::BootLoader.before_app_loads do
    Date.add_format(:matt, "%H:%M:%S %Y-%m-%d")
  end

— @public

    # File lib/merb-helpers/date_time_formatting.rb, line 90
90:     def add_format(key, format)
91:       formats.merge!({key => format})
92:     end
formats() click to toggle source

Lists the date and time formats

Returns

Hash

a hash with all formats available

— @public

    # File lib/merb-helpers/date_time_formatting.rb, line 61
61:     def formats
62:       @@formats
63:     end
reset_formats() click to toggle source

Resets the date and time formats — @private

     # File lib/merb-helpers/date_time_formatting.rb, line 98
 98:     def reset_formats
 99:       original_formats = [:db, :time, :short, :date, :long, :long_ordinal, :rfc822]
100:       formats = @@formats.delete_if{|format, v| !original_formats.include?(format)}
101:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.