Sha256: 019edee3c51e04e9035536d2632af947fffc3560dd88d827abfc4387676b97f8
Contents?: true
Size: 1011 Bytes
Versions: 2
Compression:
Stored size: 1011 Bytes
Contents
require_relative '../ruler' class Tailor module Rulers class AllowCamelCaseMethodsRuler < Tailor::Ruler def initialize(style, options) super(style, options) add_lexer_observers :ident end def ident_update(token, lexed_line, lineno, column) find_event = lexed_line.find { |e| e[1] == :on_kw && e.last == 'def' } if find_event && find_event.any? measure(token, lineno, column) end end # Checks to see if the method name contains capital letters. # # @param [Fixnum] token The method name. # @param [Fixnum] lineno Line the problem was found on. # @param [Fixnum] column Column the problem was found on. def measure(token, lineno, column) if token.contains_capital_letter? problem_message = 'Camel-case method name found.' @problems << Problem.new(problem_type, lineno, column, problem_message, @options[:level]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tailor-1.4.1 | lib/tailor/rulers/allow_camel_case_methods_ruler.rb |
tailor-1.4.0 | lib/tailor/rulers/allow_camel_case_methods_ruler.rb |