ihelp 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/ihelp.rb +20 -17
  2. metadata +2 -2
@@ -4,6 +4,7 @@ begin
4
4
  if $ihelp_full_text_search != false
5
5
  require 'rubygems'
6
6
  require 'ferret'
7
+ require 'stringio'
7
8
  require 'fileutils'
8
9
  $ihelp_full_text_search = true
9
10
  end
@@ -97,6 +98,11 @@ end
97
98
  #
98
99
  # Changelog:
99
100
  #
101
+ # 0.4.5
102
+ # Use RI environment variable to pass config to ri (thanks to Parragh Szabolcs.)
103
+ # Bugfix for missing stringio (thanks to Marcel M. Cary.)
104
+ # Show first thousand hits instead of a mere ten.
105
+ #
100
106
  # 0.4.0
101
107
  # Full-text documentation search using Ferret.
102
108
  #
@@ -110,7 +116,7 @@ end
110
116
  # Author: Ilmari Heikkinen <kig misfiring net>
111
117
  #
112
118
  module IHelp
113
- HELP_VERSION = "0.4.4"
119
+ HELP_VERSION = "0.4.5"
114
120
  end
115
121
 
116
122
 
@@ -471,7 +477,8 @@ module IHelp
471
477
  info_str = ri_driver.get_info_str(anc.name, meth_str, instance)
472
478
  }
473
479
  # Avoid returning Object in case of no help.
474
- if ancest == Object and meth_str.nil? and klass_name != Object.name
480
+ if ((ancest == Object and meth_str.nil? and klass_name != 'Object') or
481
+ (ancest == IHelp and meth_str.nil? and klass_name != 'IHelp'))
475
482
  info_str = nil
476
483
  end
477
484
  end
@@ -490,7 +497,7 @@ module IHelp
490
497
  # Create new IHelpDriver, with the given args
491
498
  # passed to @options, which is a RI::Options.instance
492
499
  #
493
- def initialize(args = [])
500
+ def initialize(args = (ENV["RI"] || "").split)
494
501
  @options = RI::Options.instance
495
502
  @options.parse(args)
496
503
 
@@ -558,15 +565,11 @@ module IHelp
558
565
  # Get info for the method in the given methods.
559
566
  #
560
567
  def get_method_info_str(requested_method_name, methods)
561
- if methods.size == 1
562
- @ri_reader.get_method(methods.first)
563
- else
564
- entries = methods.find_all {|m| m.name == requested_method_name}
565
- return nil if entries.empty?
566
- method = nil
567
- entries.find{|entry| method = @ri_reader.get_method(entry)}
568
- method
569
- end
568
+ entries = methods.find_all {|m| m.name == requested_method_name}
569
+ return nil if entries.empty?
570
+ method = nil
571
+ entries.find{|entry| method = @ri_reader.get_method(entry)}
572
+ method
570
573
  end
571
574
 
572
575
  end
@@ -738,7 +741,7 @@ module IHelp
738
741
 
739
742
  def display
740
743
  return @display if @display
741
- @display = RI::Options.instance.displayer.clone
744
+ @display = IHelp.ri_driver.display
742
745
  if ENV["PAGER"].to_s.size > 0
743
746
  unless ENV["PAGER"] =~ /(^|\/)less\b.* -[a-zA-Z]*[rR]/
744
747
  IHelp.no_colors = true
@@ -778,8 +781,8 @@ module IHelp
778
781
  #
779
782
  # See Ferret::QueryParser for query string format.
780
783
  #
781
- def search(query, *a)
782
- result = @index.search(query, *a)
784
+ def search(query)
785
+ result = @index.search(query, :limit => 1000)
783
786
  init_display
784
787
  if IHelp.no_colors or `which less`.strip.empty?
785
788
  pre_tag = "<<"
@@ -792,7 +795,7 @@ module IHelp
792
795
  end
793
796
  page do
794
797
  puts
795
- puts "=== #{result.total_hits} hits#{", showing first 10" if result.total_hits > 10} ".ljust(72,"=")
798
+ puts "=== #{result.total_hits} hits#{", showing first 1000" if result.total_hits > 1000} ".ljust(72,"=")
796
799
  puts
797
800
  result.hits.each_with_index do |hit, i|
798
801
  id, score = hit.doc, hit.score
@@ -1009,7 +1012,7 @@ if __FILE__ == $0
1009
1012
  }
1010
1013
  IHelp.instance_variable_set(
1011
1014
  :@ri_driver,
1012
- IHelp::IHelpDriver.new(IHelp::RI_ARGS))
1015
+ IHelp::IHelpDriver.new([]))
1013
1016
  end
1014
1017
 
1015
1018
  def test_simple_help
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ihelp
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.4
7
- date: 2006-11-18 00:00:00 +02:00
6
+ version: 0.4.5
7
+ date: 2007-01-05 00:00:00 +02:00
8
8
  summary: Interactive help
9
9
  require_paths:
10
10
  - lib