Class: Roodi::Checks::ClassNameCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/roodi/checks/class_name_check.rb

Instance Method Summary collapse

Methods inherited from Check

#add_error, #errors, #evaluate_node_at_line, #initialize, #position

Constructor Details

This class inherits a constructor from Roodi::Checks::Check

Instance Method Details

#evaluate(node) ⇒ Object



10
11
12
13
# File 'lib/roodi/checks/class_name_check.rb', line 10

def evaluate(node)
  pattern = /^[A-Z][a-zA-Z0-9]*$/
  add_error "Class name \"#{node[1]}\" should match pattern #{pattern.inspect}" unless node[1].to_s =~ pattern
end

#interesting_nodesObject



6
7
8
# File 'lib/roodi/checks/class_name_check.rb', line 6

def interesting_nodes
  [:class]
end