Project

General

Profile

Patch #41954 » 0005-Override-Psych-yaml-format_time-method.patch

Ko Nagase, 2024-12-09 09:39

View differences:

lib/tasks/extract_fixtures.rake
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database. Set RAILS_ENV to override.'
module Psych
module Visitors
class YAMLTree
# Override default time format
# https://github.com/ruby/ruby/blob/v3_3_6/ext/psych/lib/psych/visitors/yaml_tree.rb#L484-L490
def format_time time, utc = time.utc?
if utc
time.strftime("%Y-%m-%d %H:%M:%S")
else
time.strftime("%Y-%m-%d %H:%M:%S %:z")
end
end
end
end
end
task :extract_fixtures => :environment do
dir = ENV['DIR'] || './tmp/fixtures'
time_offset = ENV['TIME_OFFSET'] || ''
(6-6/14)