Class: Roodi::Checks::ClassNameCheck

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

Overview

Checks a class name to make sure it matches the specified pattern.

Keeping to a consistent naming convention makes your code easier to read.

Constant Summary collapse

DEFAULT_PATTERN =
/^[A-Z][a-zA-Z0-9]*$/

Constants inherited from Check

Roodi::Checks::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

#initializeClassNameCheck

Returns a new instance of ClassNameCheck.



12
13
14
15
# File 'lib/roodi/checks/class_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/class_name_check.rb', line 17

def interesting_nodes
  [:class]
end

#message_prefixObject



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

def message_prefix
  'Class'
end