diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-24 23:05:28 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-24 23:05:28 +0000 |
commit | 7222e82a8b98afdc61b9cf6ad7419068429a42e9 (patch) | |
tree | 9601822113feef70fe4f6fc19b5453dd378dcd62 /lib/rdoc/parser.rb | |
parent | da6300e8f888d0664347a5f2fb43dc749df7b5ad (diff) | |
download | ruby-7222e82a8b98afdc61b9cf6ad7419068429a42e9.tar.gz |
Import RDoc 2.2.2 r192
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parser.rb')
-rw-r--r-- | lib/rdoc/parser.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index 6855cfcfc5..c37256dbd8 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -68,7 +68,12 @@ class RDoc::Parser def self.binary?(file) s = (File.read(file, File.stat(file).blksize) || "").split(//) - ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30 + + if s.size > 0 then + ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30 + else + false + end end private_class_method :binary? @@ -106,6 +111,13 @@ class RDoc::Parser parser = can_parse file_name + # + # This method must return a parser. + # + if !parser then + parser = RDoc::Parser::Simple + end + parser.new top_level, file_name, body, options, stats end |