Class: FashionPolice::SpacesInFunctionDeclarations

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

Instance Method Summary collapse

Instance Method Details

#error_messageObject



35
36
37
# File 'lib/fashion-police.rb', line 35

def error_message
  "Put spaces in function declarations"
end

#test(string) ⇒ Object



28
29
30
31
32
33
# File 'lib/fashion-police.rb', line 28

def test(string)
  return false if string.match(/function\(\.*\)\{/)
  return false if string.match(/function\s+\(.*\)\{/)
  return true if string.match(/function\s+\(.*\)\s+\{/)
  return true
end