Module: DidYouMean::Correctable
- Defined in:
- lib/did_you_mean/core_ext/name_error.rb
Instance Attribute Summary collapse
-
#frame_binding ⇒ Object
readonly
Returns the value of attribute frame_binding.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#frame_binding ⇒ Object (readonly)
Returns the value of attribute frame_binding.
3 4 5 |
# File 'lib/did_you_mean/core_ext/name_error.rb', line 3 def frame_binding @frame_binding end |
Class Method Details
.included(klass) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/did_you_mean/core_ext/name_error.rb', line 11 def self.included(klass) klass.class_eval do __to_s__ = klass.instance_method(:to_s) define_method(:original_message){ __to_s__.bind(self).call } def to_s msg = .dup bt = caller.first(6) msg << Formatter.new(suggestions).to_s if IGNORED_CALLERS.all? {|ignored| bt.grep(ignored).empty? } msg rescue end end end |
Instance Method Details
#finder ⇒ Object
32 33 34 |
# File 'lib/did_you_mean/core_ext/name_error.rb', line 32 def finder @finder ||= DidYouMean.finders[self.class.to_s].new(self) end |
#suggestions ⇒ Object
28 29 30 |
# File 'lib/did_you_mean/core_ext/name_error.rb', line 28 def suggestions finder.suggestions end |