1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix signature

This commit is contained in:
David Heinemeier Hansson 2022-02-07 15:30:02 +01:00
parent 43ea6e6893
commit d61ab614c2
3 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ class DateTime
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
def to_fs :default)
def to_fs(format = :default)
if formatter = ::Time::DATE_FORMATS[format]
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
else

View file

@ -27,7 +27,7 @@ module ActiveSupport
#
# # config/initializers/range_formats.rb
# Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" }
def to_fs :default)
def to_fs(format = :default)
if formatter = RANGE_FORMATS[format]
formatter.call(first, last)
else

View file

@ -50,7 +50,7 @@ class Time
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
def to_fs :default)
def to_fs(format = :default)
if formatter = DATE_FORMATS[format]
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
else