Class: FashionPolice::SpacesAroundArgumentsInParens

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

Instance Method Summary collapse

Instance Method Details

#error_messageObject



90
91
92
# File 'lib/fashion-police.rb', line 90

def error_message
  "Put spaces around arguments inside parentheses"
end

#test(string) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/fashion-police.rb', line 81

def test(string)
  return true if string.match(/\( .* \)/)
  return true if string.match(/\S*\(function\(/)
  return true if string.match(/\S+\(["'].*["']\)/)
  return false if string.match(/\(\S+\)/)

  return true
end