12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/tdiary/compatible.rb', line 12
def transaction(*args, &block)
begin
compatible_transaction_original(*args, &block)
rescue PStoreRuby18Exception
file = open_and_lock_file(@filename, false)
table = Marshal::load(file, proc {|obj|
if obj.respond_to?('force_encoding') && obj.encoding == Encoding::ASCII_8BIT
obj.force_encoding('UTF-8')
end
obj
})
table[:__ruby_version] = RUBY_VERSION
if on_windows?
save_data_with_fast_strategy(Marshal::dump(table), file)
else
save_data_with_atomic_file_rename_strategy(Marshal::dump(table), file)
end
retry
end
end
|