Class: Scruffy::Formatters::Date

Inherits:
Base
  • Object
show all
Defined in:
lib/scruffy/formatters.rb

Instance Method Summary collapse

Methods inherited from Base

#route_format

Constructor Details

#initialize(format_string, options = {}) ⇒ Date

Returns a new instance of Date.



216
217
218
# File 'lib/scruffy/formatters.rb', line 216

def initialize(format_string, options = {})
  @format_string = format_string
end

Instance Method Details

#format(target, idx, options) ⇒ Object

Formats percentages.



221
222
223
224
225
226
227
# File 'lib/scruffy/formatters.rb', line 221

def format(target, idx, options)
  begin
    target.strftime(@format_string)
  rescue
    target
  end
end