class Tailor::Rulers::AllowCamelCaseMethodsRuler
Public Class Methods
new(style, options)
click to toggle source
Calls superclass method
Tailor::Ruler::new
# File lib/tailor/rulers/allow_camel_case_methods_ruler.rb, line 6 def initialize(style, options) super(style, options) add_lexer_observers :ident end
Public Instance Methods
ident_update(token, lexed_line, lineno, column)
click to toggle source
# File lib/tailor/rulers/allow_camel_case_methods_ruler.rb, line 11 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
measure(token, lineno, column)
click to toggle source
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.
# File lib/tailor/rulers/allow_camel_case_methods_ruler.rb, line 24 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