Class: DidYouMean::NameFinder
- Inherits:
-
Object
- Object
- DidYouMean::NameFinder
- Includes:
- BaseFinder
- Defined in:
- lib/did_you_mean/finders/name_error_finders/name_finder.rb
Constant Summary
Constants included from BaseFinder
BaseFinder::AT, BaseFinder::EMPTY
Instance Attribute Summary collapse
-
#cvar_names ⇒ Object
readonly
Returns the value of attribute cvar_names.
-
#ivar_names ⇒ Object
readonly
Returns the value of attribute ivar_names.
-
#lvar_names ⇒ Object
readonly
Returns the value of attribute lvar_names.
-
#method_names ⇒ Object
readonly
Returns the value of attribute method_names.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(exception) ⇒ NameFinder
constructor
A new instance of NameFinder.
- #searches ⇒ Object
Methods included from BaseFinder
Constructor Details
#initialize(exception) ⇒ NameFinder
Returns a new instance of NameFinder.
6 7 8 9 10 11 12 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 6 def initialize(exception) @name = exception.name.to_s.tr(AT, EMPTY) @lvar_names = exception.frame_binding.eval("local_variables") @method_names = exception.frame_binding.eval("methods + private_methods") @cvar_names = exception.frame_binding.eval("self.class.class_variables") @ivar_names = exception.frame_binding.eval("instance_variables") end |
Instance Attribute Details
#cvar_names ⇒ Object (readonly)
Returns the value of attribute cvar_names.
4 5 6 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 4 def cvar_names @cvar_names end |
#ivar_names ⇒ Object (readonly)
Returns the value of attribute ivar_names.
4 5 6 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 4 def ivar_names @ivar_names end |
#lvar_names ⇒ Object (readonly)
Returns the value of attribute lvar_names.
4 5 6 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 4 def lvar_names @lvar_names end |
#method_names ⇒ Object (readonly)
Returns the value of attribute method_names.
4 5 6 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 4 def method_names @method_names end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 4 def name @name end |
Instance Method Details
#searches ⇒ Object
14 15 16 |
# File 'lib/did_you_mean/finders/name_error_finders/name_finder.rb', line 14 def searches {name => (lvar_names + method_names + ivar_names + cvar_names)} end |