Class: Tailor::Rulers::AllowCamelCaseMethodsRuler
- Inherits:
-
Tailor::Ruler
- Object
- Tailor::Ruler
- Tailor::Rulers::AllowCamelCaseMethodsRuler
- Defined in:
- lib/tailor/rulers/allow_camel_case_methods_ruler.rb
Instance Attribute Summary
Attributes inherited from Tailor::Ruler
Instance Method Summary collapse
- #ident_update(token, lexed_line, lineno, column) ⇒ Object
-
#initialize(style, options) ⇒ AllowCamelCaseMethodsRuler
constructor
A new instance of AllowCamelCaseMethodsRuler.
-
#measure(token, lineno, column) ⇒ Object
Checks to see if the method name contains capital letters.
Methods inherited from Tailor::Ruler
#add_child_ruler, #problem_type, #problems
Methods included from Logger::Mixin
Constructor Details
#initialize(style, options) ⇒ AllowCamelCaseMethodsRuler
Returns a new instance of AllowCamelCaseMethodsRuler.
6 7 8 9 |
# File 'lib/tailor/rulers/allow_camel_case_methods_ruler.rb', line 6 def initialize(style, ) super(style, ) add_lexer_observers :ident end |
Instance Method Details
#ident_update(token, lexed_line, lineno, column) ⇒ Object
11 12 13 14 15 16 17 |
# 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) ⇒ Object
Checks to see if the method name contains capital letters.
24 25 26 27 28 29 30 31 |
# File 'lib/tailor/rulers/allow_camel_case_methods_ruler.rb', line 24 def measure(token, lineno, column) if token.contains_capital_letter? = 'Camel-case method name found.' @problems << Problem.new(problem_type, lineno, column, , @options[:level]) end end |