guessmethod 0.1.0 → 0.1.1

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.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.1.1 2007-11-08
2
+
3
+ * Changed old_const_missing and old_method_missing to the less likely to blow up unguessed_const_missing and unguessed_method_missing
4
+ * Call the original const_missing, rescue, then do the guessing. This effectively lets you use GuessMethod with rails.
5
+
1
6
  == 0.1.0 2007-09-23
2
7
 
3
8
  * Moved GuessConstant to inside GuessMethod
data/lib/guessmethod.rb CHANGED
@@ -23,7 +23,7 @@ module GuessMethod
23
23
  unless method_defined? :method_missing
24
24
  def method_missing(meth, *args, &block); super; end
25
25
  end
26
- alias_method :old_method_missing, :method_missing
26
+ alias_method :unguessed_method_missing, :method_missing
27
27
  alias_method :method_missing, :guess_method_missing
28
28
 
29
29
  base.extend(GuessConstant)
@@ -40,13 +40,13 @@ module GuessMethod
40
40
  self.send(call_method, *args, &block)
41
41
  when 0
42
42
  $stderr.puts GuessMethodOutputter.no_method_in_threshold(meth, self)
43
- old_method_missing(meth, *args, &block)
43
+ unguessed_method_missing(meth, *args, &block)
44
44
  else
45
45
  $stderr.puts GuessMethodOutputter.ambiguous_method(meth, possible_methods, self)
46
- old_method_missing(meth, *args, &block)
46
+ unguessed_method_missing(meth, *args, &block)
47
47
  end
48
48
  else
49
- old_method_missing(meth, *args, &block)
49
+ unguessed_method_missing(meth, *args, &block)
50
50
  end
51
51
  end
52
52
 
@@ -64,7 +64,7 @@ module GuessMethod
64
64
  def self.const_missing(sym); super; end
65
65
  end
66
66
  class << self
67
- alias_method :old_const_missing, :const_missing
67
+ alias_method :unguessed_const_missing, :const_missing
68
68
  alias_method :const_missing, :guess_const_missing
69
69
  end
70
70
  end
@@ -72,6 +72,10 @@ module GuessMethod
72
72
 
73
73
  def guess_const_missing(sym)
74
74
  if GuessMethodOptions[:active]
75
+ begin
76
+ return unguessed_const_missing(sym)
77
+ rescue NameError
78
+ end
75
79
  possible_consts = GuessMethodGuesser.find_closest(self.constants, sym)
76
80
  case possible_consts.size
77
81
  when 1
@@ -80,13 +84,13 @@ module GuessMethod
80
84
  self.const_get(call_const)
81
85
  when 0
82
86
  $stderr.puts GuessMethodOutputter.no_const_in_threshold(sym, self)
83
- old_const_missing(sym)
87
+ unguessed_const_missing(sym)
84
88
  else
85
89
  $stderr.puts GuessMethodOutputter.ambigious_const(sym, possible_consts, self)
86
- old_const_missing(sym)
90
+ unguessed_const_missing(sym)
87
91
  end
88
92
  else
89
- old_const_missing(sym)
93
+ unguessed_const_missing(sym)
90
94
  end
91
95
  end
92
96
  end
@@ -199,4 +203,5 @@ end
199
203
 
200
204
  require 'guessmethod/version'
201
205
 
202
- class Object; include GuessMethod; end
206
+ class Object; include GuessMethod; end
207
+ class Module; extend GuessMethod::GuessConstant; end
@@ -2,7 +2,7 @@ module GuessMethod #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>Guess Method</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/guessmethod"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/guessmethod" class="numbers">0.1.0</a>
36
+ <a href="http://rubyforge.org/projects/guessmethod" class="numbers">0.1.1</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;guessmethod&#8217;</h1>
39
39
 
@@ -114,6 +114,9 @@ attention: sending exit instead of eixt to main:Object
114
114
 
115
115
  <pre>require 'guessmethod' unless ENV.include?('RAILS_ENV')</pre>
116
116
 
117
+ <p>As of 0.1.1, GuessMethod and Rails can play nice, but only if Rails shows up in the environment first. It appears that for script/console if <code>require 'guessmethod'</code> is in your irbrc, GuessMethod gets included first. But you can now safely (I think) require it after your session has started. Maybe I&#8217;ll be able to figure this issue out.</p>
118
+
119
+
117
120
  <h2>License</h2>
118
121
 
119
122
 
@@ -125,7 +128,7 @@ attention: sending exit instead of eixt to main:Object
125
128
 
126
129
  <p>Comments are welcome. Send an email to chris @@ tie-rack .. org.</p>
127
130
  <p class="coda">
128
- website generated via <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>'s <a href="http://newgem.rubyforge.org/">newgem</a>, on 23rd September 2007<br>
131
+ website generated via <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>'s <a href="http://newgem.rubyforge.org/">newgem</a>, on 8th November 2007<br>
129
132
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
130
133
  </p>
131
134
  </div>
data/website/index.txt CHANGED
@@ -62,6 +62,8 @@ If you're trying to have GuessMethod in your .irbrc (like me), but not have it g
62
62
 
63
63
  <pre>require 'guessmethod' unless ENV.include?('RAILS_ENV')</pre>
64
64
 
65
+ As of 0.1.1, GuessMethod and Rails can play nice, but only if Rails shows up in the environment first. It appears that for script/console if <code>require 'guessmethod'</code> is in your irbrc, GuessMethod gets included first. But you can now safely (I think) require it after your session has started. Maybe I'll be able to figure this issue out.
66
+
65
67
  h2. License
66
68
 
67
69
  This code is free to use under the terms of the MIT license.
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: guessmethod
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-09-23 00:00:00 -06:00
6
+ version: 0.1.1
7
+ date: 2007-11-08 00:00:00 -07:00
8
8
  summary: an aggressive spell checker for irb
9
9
  require_paths:
10
10
  - lib