Class: Roodi::Checks::MethodNameCheck
- Defined in:
- lib/roodi/checks/method_name_check.rb
Overview
Checks a method name to make sure it matches the specified pattern.
Keeping to a consistent nameing convention makes your code easier to read.
Constant Summary collapse
- DEFAULT_PATTERN =
/^[_a-z<>=\[|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/
Constants inherited from Check
Instance Attribute Summary
Attributes inherited from NameCheck
Instance Method Summary collapse
- #find_name(node) ⇒ Object
-
#initialize ⇒ MethodNameCheck
constructor
A new instance of MethodNameCheck.
- #interesting_nodes ⇒ Object
- #message_prefix ⇒ Object
Methods inherited from NameCheck
Methods inherited from Check
#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #evaluate_start, make, #position, #start_file
Constructor Details
#initialize ⇒ MethodNameCheck
Returns a new instance of MethodNameCheck.
12 13 14 15 |
# File 'lib/roodi/checks/method_name_check.rb', line 12 def initialize super() self.pattern = DEFAULT_PATTERN end |
Instance Method Details
#find_name(node) ⇒ Object
25 26 27 |
# File 'lib/roodi/checks/method_name_check.rb', line 25 def find_name(node) node[1] end |
#interesting_nodes ⇒ Object
17 18 19 |
# File 'lib/roodi/checks/method_name_check.rb', line 17 def interesting_nodes [:defn] end |
#message_prefix ⇒ Object
21 22 23 |
# File 'lib/roodi/checks/method_name_check.rb', line 21 def 'Method' end |