Class: FashionPolice::FourSpaces

Inherits:
Object
  • Object
show all
Defined in:
lib/fashion-police.rb

Instance Method Summary collapse

Instance Method Details

#error_message ⇒ Object



22
23
24
# File 'lib/fashion-police.rb', line 22

def error_message
  "Four spaces per indentation level"
end

#test(string) ⇒ Object



15
16
17
18
19
20
# File 'lib/fashion-police.rb', line 15

def test(string)
  spaces = string.match(/^(\s+)\S/)
  return true unless spaces && spaces[1]

  return (spaces[1].length % 4 == 0)
end