Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/ndr_support/date_and_time_extensions.rb

Overview


Instance Method Summary collapse

Instance Method Details

#orig_to_sObject



41
# File 'lib/ndr_support/date_and_time_extensions.rb', line 41

alias orig_to_s to_s

#to_isoObject

to_iso output must be SQL safe for security reasons



37
38
39
# File 'lib/ndr_support/date_and_time_extensions.rb', line 37

def to_iso
  strftime('%Y-%m-%dT%H:%M:%S')
end

#to_s(format = :default) ⇒ Object

Rails 7 stops overriding to_s (without a format specification) (for performance on Ruby 3.1) cf. activesupport-7.0.4/lib/active_support/core_ext/date/deprecated_conversions.rb We keep overriding this for compatibility



46
47
48
49
50
51
52
# File 'lib/ndr_support/date_and_time_extensions.rb', line 46

def to_s(format = :default)
  if format == :default
    to_formatted_s(:default)
  else
    orig_to_s(format)
  end
end