Class: Roodi::Checks::ModuleNameCheck

Inherits:
NameCheck show all
Defined in:
lib/roodi/checks/module_name_check.rb

Overview

Checks a module 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-zA-Z0-9]*$/

Constants inherited from Check

Check::NODE_TYPES

Instance Attribute Summary

Attributes inherited from NameCheck

#pattern

Instance Method Summary collapse

Methods inherited from NameCheck

#evaluate_start, #find_name

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

#initializeModuleNameCheck

Returns a new instance of ModuleNameCheck.



12
13
14
15
# File 'lib/roodi/checks/module_name_check.rb', line 12

def initialize
  super()
  self.pattern = DEFAULT_PATTERN
end

Instance Method Details

#interesting_nodesObject



17
18
19
# File 'lib/roodi/checks/module_name_check.rb', line 17

def interesting_nodes
  [:module]
end

#message_prefixObject



21
22
23
# File 'lib/roodi/checks/module_name_check.rb', line 21

def message_prefix
  'Module'
end