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 Method Summary collapse
- #find_name(node) ⇒ Object
-
#initialize(options = {}) ⇒ MethodNameCheck
constructor
A new instance of MethodNameCheck.
Methods inherited from NameCheck
#evaluate_start, #interesting_nodes
Methods inherited from Check
#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #evaluate_start, #position, #start_file
Constructor Details
#initialize(options = {}) ⇒ MethodNameCheck
Returns a new instance of MethodNameCheck.
11 12 13 14 |
# File 'lib/roodi/checks/method_name_check.rb', line 11 def initialize( = {}) pattern = ['pattern'] || DEFAULT_PATTERN super([:defn], pattern, 'Method') end |
Instance Method Details
#find_name(node) ⇒ Object
16 17 18 |
# File 'lib/roodi/checks/method_name_check.rb', line 16 def find_name(node) node[1] end |