Class: Roodi::Checks::NameCheck
- Defined in:
- lib/roodi/checks/name_check.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Check
Instance Method Summary collapse
- #evaluate_start(node) ⇒ Object
-
#initialize(interesting_nodes, pattern, message_prefix) ⇒ NameCheck
constructor
A new instance of NameCheck.
- #interesting_nodes ⇒ Object
Methods inherited from Check
#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #position, #start_file
Constructor Details
#initialize(interesting_nodes, pattern, message_prefix) ⇒ NameCheck
Returns a new instance of NameCheck.
6 7 8 9 10 11 |
# File 'lib/roodi/checks/name_check.rb', line 6 def initialize(interesting_nodes, pattern, ) super() @interesting_nodes = interesting_nodes @pattern = pattern @message_prefix = end |
Instance Method Details
#evaluate_start(node) ⇒ Object
17 18 19 20 |
# File 'lib/roodi/checks/name_check.rb', line 17 def evaluate_start(node) name = find_name(node) add_error "#{@message_prefix} name \"#{name}\" should match pattern #{@pattern.inspect}" unless name.to_s =~ @pattern end |
#interesting_nodes ⇒ Object
13 14 15 |
# File 'lib/roodi/checks/name_check.rb', line 13 def interesting_nodes @interesting_nodes end |