Class: FashionPolice::SpacesAroundElses

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

Instance Method Summary collapse

Instance Method Details

#error_messageObject



51
52
53
# File 'lib/fashion-police.rb', line 51

def error_message
  "Put spaces around elses"
end

#test(string) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/fashion-police.rb', line 41

def test(string)
  return true if string.match(/\} else \{/)
  return false if string.match(/\}else\{/)
  return false if string.match(/\} +else\{/)
  return false if string.match(/\}else +\{/)
  return false if string.match(/\} +else ?\{/)
  return false if string.match(/\} ?else +\{/)
  return true
end