This module provides functionality for checking if names match the configured EnforcedStyle.
Returns a range containing the method name after the given regexp and a dot.
# File lib/rubocop/cop/mixin/configurable_naming.rb, line 33 def after_dot(node, method_name_length, regexp) expr = node.loc.expression match = /\A#{regexp}\s*\.\s*/.match(expr.source) return unless match offset = match[0].length begin_pos = expr.begin_pos + offset Parser::Source::Range.new(expr.source_buffer, begin_pos, begin_pos + method_name_length) end
# File lib/rubocop/cop/mixin/configurable_naming.rb, line 12 def check(node, range) return unless range name = range.source.to_sym return if operator?(name) if matches_config?(name) correct_style_detected else add_offense(node, range, message(style)) do opposite_style_detected end end end
Generated with the Darkfish Rdoc Generator 2.