Class: FashionPolice::SpacesAroundArgumentsInSquareBrackets

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

Instance Method Summary collapse

Instance Method Details

#error_messageObject



129
130
131
# File 'lib/fashion-police.rb', line 129

def error_message
  "Put spaces around arguments inside square brackets"
end

#test(string) ⇒ Object



122
123
124
125
126
127
# File 'lib/fashion-police.rb', line 122

def test(string)
  return true if string.match(/\[ .* \]/)
  return false if string.match(/\[[^\]]+\]/)

  return true
end