Class: Roodi::Checks::NameCheck

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

Direct Known Subclasses

ClassNameCheck, MethodNameCheck, ModuleNameCheck

Instance Method Summary collapse

Methods inherited from Check

#add_error, #errors, #evaluate_node_at_line, #position

Constructor Details

#initialize(interesting_nodes, pattern, message_prefix) ⇒ NameCheck

Returns a new instance of NameCheck.



9
10
11
12
13
14
# File 'lib/roodi/checks/name_check.rb', line 9

def initialize(interesting_nodes, pattern, message_prefix)
  super()
  @interesting_nodes = interesting_nodes
  @pattern           = pattern
  @message_prefix    = message_prefix
end

Instance Method Details

#evaluate(node) ⇒ Object



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

def evaluate(node)
  name = find_name(node)
  add_error(build_options(node)) unless name.to_s =~ @pattern
end

#interesting_nodesObject



16
17
18
# File 'lib/roodi/checks/name_check.rb', line 16

def interesting_nodes
  @interesting_nodes
end