summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-09 13:15:12 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-09 13:15:12 +0000
commit587016b485794e5b34a3965854f46b1cab36e073 (patch)
tree8e5cb58bf62715fec38f336e649b68bd9655eb2b /lib
parent27cec63246ee836a272b8309b39a65a1bd7d11b2 (diff)
merges r33264 from trunk into ruby_1_9_3.
-- * lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pstore.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb
index 9fb0249f3c..020b028666 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -94,10 +94,9 @@ require "thread"
# Needless to say, if you're storing valuable data with PStore, then you should
# backup the PStore files from time to time.
class PStore
- binmode = defined?(File::BINARY) ? File::BINARY : 0
- RDWR_ACCESS = File::RDWR | File::CREAT | binmode
- RD_ACCESS = File::RDONLY | binmode
- WR_ACCESS = File::WRONLY | File::CREAT | File::TRUNC | binmode
+ RDWR_ACCESS = {mode: IO::RDWR | IO::CREAT | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
+ RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
+ WR_ACCESS = {mode: IO::WRONLY | IO::CREAT | IO::TRUNC | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
# The error type thrown by all PStore methods.
class Error < StandardError