Class: DidYouMean::MethodNameChecker
- Inherits:
-
Object
- Object
- DidYouMean::MethodNameChecker
- Includes:
- SpellCheckable
- Defined in:
- lib/did_you_mean/spell_checkers/method_name_checker.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Instance Method Summary collapse
- #candidates ⇒ Object
-
#initialize(exception) ⇒ MethodNameChecker
constructor
A new instance of MethodNameChecker.
- #method_names ⇒ Object
Methods included from SpellCheckable
Constructor Details
#initialize(exception) ⇒ MethodNameChecker
Returns a new instance of MethodNameChecker.
6 7 8 9 10 |
# File 'lib/did_you_mean/spell_checkers/method_name_checker.rb', line 6 def initialize(exception) @method_name = exception.name @receiver = exception.receiver @has_args = !exception.args&.empty? end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
4 5 6 |
# File 'lib/did_you_mean/spell_checkers/method_name_checker.rb', line 4 def method_name @method_name end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
4 5 6 |
# File 'lib/did_you_mean/spell_checkers/method_name_checker.rb', line 4 def receiver @receiver end |
Instance Method Details
#candidates ⇒ Object
12 13 14 |
# File 'lib/did_you_mean/spell_checkers/method_name_checker.rb', line 12 def candidates { method_name => method_names } end |
#method_names ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/did_you_mean/spell_checkers/method_name_checker.rb', line 16 def method_names method_names = receiver.methods + receiver.singleton_methods method_names += receiver.private_methods if @has_args method_names.delete(method_name) method_names.uniq! method_names end |