mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix signature
This commit is contained in:
parent
43ea6e6893
commit
d61ab614c2
3 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ class DateTime
|
||||||
# # config/initializers/time_formats.rb
|
# # config/initializers/time_formats.rb
|
||||||
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
|
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
|
||||||
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
|
# 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]
|
if formatter = ::Time::DATE_FORMATS[format]
|
||||||
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@ module ActiveSupport
|
||||||
#
|
#
|
||||||
# # config/initializers/range_formats.rb
|
# # config/initializers/range_formats.rb
|
||||||
# Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" }
|
# 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]
|
if formatter = RANGE_FORMATS[format]
|
||||||
formatter.call(first, last)
|
formatter.call(first, last)
|
||||||
else
|
else
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Time
|
||||||
# # config/initializers/time_formats.rb
|
# # config/initializers/time_formats.rb
|
||||||
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
|
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
|
||||||
# Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
|
# 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]
|
if formatter = DATE_FORMATS[format]
|
||||||
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue