Module: FormattedTimes

Defined in:
lib/formatted_times.rb,
lib/formatted_times/version.rb

Constant Summary collapse

VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.define_formats(formats) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/formatted_times.rb', line 8

def self.define_formats(formats)
  return false unless formats.is_a? Hash
  formats.each do |name, format|
    ActiveSupport::TimeWithZone.instance_eval {
      define_method name.to_sym do
        strftime(format)
      end
    }
  end
end