summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-24 23:05:28 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-24 23:05:28 +0000
commit7222e82a8b98afdc61b9cf6ad7419068429a42e9 (patch)
tree9601822113feef70fe4f6fc19b5453dd378dcd62 /lib
parentda6300e8f888d0664347a5f2fb43dc749df7b5ad (diff)
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')
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/parser.rb14
-rw-r--r--lib/rdoc/parser/c.rb1
-rw-r--r--lib/rdoc/ri/display.rb9
-rw-r--r--lib/rdoc/ri/paths.rb6
5 files changed, 21 insertions, 11 deletions
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index 797b119fbf..f4fc3867cf 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -372,7 +372,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = "2.2.1"
+ VERSION = "2.2.2"
##
# Name of the dotfile that contains the description of files to be processed
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
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index a5b06c2b04..9061841bec 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -1,4 +1,5 @@
require 'rdoc/parser'
+require 'rdoc/parser/ruby'
require 'rdoc/known_classes'
##
diff --git a/lib/rdoc/ri/display.rb b/lib/rdoc/ri/display.rb
index 05a7cf253d..7b0158c18a 100644
--- a/lib/rdoc/ri/display.rb
+++ b/lib/rdoc/ri/display.rb
@@ -5,8 +5,8 @@ require 'rdoc/ri'
begin
require('readline')
require('abbrev')
- CAN_USE_READLINE = true
-rescue
+ CAN_USE_READLINE = true # HACK use an RDoc namespace constant
+rescue LoadError
CAN_USE_READLINE = false
end
@@ -53,7 +53,7 @@ class RDoc::RI::DefaultDisplay
def display_class_info(klass)
page do
- superclass = klass.superclass_string
+ superclass = klass.superclass
if superclass
superclass = " < " + superclass
@@ -217,7 +217,7 @@ class RDoc::RI::DefaultDisplay
end
method_names.sort!
- @formatter.wrap method_names.join(',')
+ @formatter.wrap method_names.join(', ')
end
end
@@ -390,4 +390,3 @@ class RDoc::RI::DefaultDisplay
end
end
-
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index 037606ec27..2f72b9dfd5 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
@@ -28,15 +28,13 @@ module RDoc::RI::Paths
VERSION = RbConfig::CONFIG['ruby_version']
- ri = RbConfig::CONFIG['RUBY_INSTALL_NAME'].sub(/ruby/, 'ri')
- base = File.join(RbConfig::CONFIG['datadir'], ri, VERSION)
+ base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION)
SYSDIR = File.join(base, "system")
SITEDIR = File.join(base, "site")
homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']
if homedir then
- rdoc = RbConfig::CONFIG['RUBY_INSTALL_NAME'].sub(/ruby/, 'rdoc')
- HOMEDIR = File.join(homedir, ".#{rdoc}")
+ HOMEDIR = File.join(homedir, ".rdoc")
else
HOMEDIR = nil
end