Class: MethodIndentation

Inherits:
Object
  • Object
show all
Defined in:
lib/rules/method_indentation.rb

Constant Summary collapse

TABS =
2

Instance Method Summary collapse

Constructor Details

#initialize(max) ⇒ MethodIndentation

Returns a new instance of MethodIndentation.



4
5
6
# File 'lib/rules/method_indentation.rb', line 4

def initialize(max)
  @max = max + 2 # including class and def indent
end

Instance Method Details

#messageObject



12
13
14
# File 'lib/rules/method_indentation.rb', line 12

def message
  "indentation is more than #{@max} levels"
end

#valid?(method) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rules/method_indentation.rb', line 8

def valid?(method)
  max_indent(method) <= @max
end