Skip to content

Commit 291a4c6

Browse files
committed
Cleanup
1 parent c9a5d6b commit 291a4c6

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

lib/rdoc/ri/display.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def display_class_info(klass)
126126
# the methods.
127127

128128
def get_class_method_choice(method_map)
129-
if CAN_USE_READLINE
129+
if CAN_USE_READLINE then
130130
# prepare abbreviations for tab completion
131131
abbreviations = method_map.keys.abbrev
132132
Readline.completion_proc = proc do |string|

lib/rdoc/ri/driver.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def self.convert(object)
2727
new_hash = new # Convert Hash -> OpenStructHash
2828

2929
object.each do |key, value|
30-
new_hash[key] = convert(value)
30+
new_hash[key] = convert value
3131
end
3232

3333
new_hash
3434
when Array then
3535
object.map do |element|
36-
convert(element)
36+
convert element
3737
end
3838
else
3939
object
@@ -511,12 +511,11 @@ def create_cache_for(klassname, path)
511511
# Finds the next ancestor of +orig_klass+ after +klass+.
512512

513513
def lookup_ancestor(klass, orig_klass)
514-
# This is a bit hacky, but ri will go into an infinite
515-
# loop otherwise, since Object has an Object ancestor
516-
# for some reason. Depending on the documentation state, I've seen
517-
# Kernel as an ancestor of Object and not as an ancestor of Object.
518-
if ((orig_klass == "Object") &&
519-
((klass == "Kernel") || (klass == "Object")))
514+
# This is a bit hacky, but ri will go into an infinite loop otherwise,
515+
# since Object has an Object ancestor for some reason. Depending on the
516+
# documentation state, I've seen Kernel as an ancestor of Object and not
517+
# as an ancestor of Object.
518+
if orig_klass == "Object" && (klass == "Kernel" || klass == "Object") then
520519
return nil
521520
end
522521

@@ -528,7 +527,7 @@ def lookup_ancestor(klass, orig_klass)
528527
ancestors.push(*cache.includes.map { |inc| inc['name'] })
529528
ancestors << cache.superclass
530529

531-
ancestor_index = ancestors.index(klass)
530+
ancestor_index = ancestors.index klass
532531

533532
if ancestor_index
534533
ancestor = ancestors[ancestors.index(klass) + 1]
@@ -578,22 +577,23 @@ def read_yaml(path)
578577
data = data.gsub(/ \!ruby\/(object|struct):(RDoc::RI|RI).*/, '')
579578
data = data.gsub(/ \!ruby\/(object|struct):SM::(\S+)/,
580579
' !ruby/\1:RDoc::Markup::\2')
581-
OpenStructHash.convert(YAML.load(data))
580+
581+
OpenStructHash.convert YAML.load(data)
582582
end
583583

584584
def run
585-
if(@list_doc_dirs)
586-
puts @doc_dirs.join("\n")
585+
if @list_doc_dirs then
586+
puts @doc_dirs
587587
elsif @names.empty? then
588588
@display.list_known_classes class_cache.keys.sort
589589
else
590590
@names.each do |name|
591591
if class_cache.key? name then
592592
method_map = display_class name
593-
if(@interactive)
593+
if @interactive then
594594
method_name = @display.get_class_method_choice(method_map)
595595

596-
if(method_name != nil)
596+
if method_name then
597597
method = lookup_method "#{name}#{method_name}", name
598598
display_method method
599599
end
@@ -628,7 +628,7 @@ def run
628628
elsif methods.size == 1
629629
display_method methods[0]
630630
else
631-
if(@interactive)
631+
if @interactive then
632632
@display.display_method_list_choice methods
633633
else
634634
@display.display_method_list methods
@@ -657,7 +657,7 @@ def select_methods(pattern)
657657
end
658658

659659
def write_cache(cache, path)
660-
if(@use_cache)
660+
if @use_cache then
661661
File.open path, "wb" do |cache_file|
662662
Marshal.dump cache, cache_file
663663
end

0 commit comments

Comments
 (0)