diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-27 01:25:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-27 01:25:01 +0000 |
commit | 6d05d11a0a7f44143a1b2634b42f4ba1e6e1c580 (patch) | |
tree | 0ce5c5ec0b7180d66b36c3092458139cdead73a2 /lib/rdoc | |
parent | 5b75bb4b0c5c8ee42ba2fe059854a20ede7b4697 (diff) | |
download | ruby-6d05d11a0a7f44143a1b2634b42f4ba1e6e1c580.tar.gz ruby-6d05d11a0a7f44143a1b2634b42f4ba1e6e1c580.tar.xz ruby-6d05d11a0a7f44143a1b2634b42f4ba1e6e1c580.zip |
* lib/rdoc/parser.rb (RDoc::Parser.binary?): fix for empty files.
[ruby-dev:38848]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
-rw-r--r-- | lib/rdoc/parser.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index bb7e0c7d8..3798734d5 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -66,8 +66,8 @@ class RDoc::Parser # Return _true_ if the +file+ seems like binary. def self.binary?(file) - s = File.read(file, 1024) - s.count("^ -~\t\r\n").fdiv(s.size) > 0.3 || s.index("\x00") unless s.empty? + s = File.read(file, 1024) or return false + s.count("^ -~\t\r\n").fdiv(s.size) > 0.3 || s.index("\x00") end private_class_method :binary? |