diff options
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 |