aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mathn.rb3
-rw-r--r--lib/pstore.rb2
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb
index 2257a4074a..aa2da885f3 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -16,6 +16,7 @@ require "matrix.rb"
class Integer
+ remove_method(:gcd2)
def gcd2(int)
a = self.abs
b = int.abs
@@ -116,6 +117,7 @@ end
class Rational
Unify = true
+ remove_method(:inspect)
def inspect
format "%s/%s", numerator.inspect, denominator.inspect
end
@@ -228,6 +230,7 @@ class Rational
end
module Math
+ remove_method(:sqrt)
def sqrt(a)
if a.kind_of?(Complex)
abs = sqrt(a.real*a.real + a.image*a.image)
diff --git a/lib/pstore.rb b/lib/pstore.rb
index c4c6dd56a5..dc4d976a4c 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -99,11 +99,13 @@ class PStore
content = nil
unless read_only
file = File.open(@filename, File::RDWR | File::CREAT)
+ file.binmode
file.flock(File::LOCK_EX)
commit_new(file) if FileTest.exist?(new_file)
content = file.read()
else
file = File.open(@filename, File::RDONLY)
+ file.binmode
file.flock(File::LOCK_SH)
content = (File.read(new_file) rescue file.read())
end