Sha256: 9bacc9b0e876aa8d2fbe2e493f97f2daa62c1b3e9e8d47fa50cf468c14442619
Contents?: true
Size: 713 Bytes
Versions: 20
Compression:
Stored size: 713 Bytes
Contents
class App.Validators.Vulgarity extends App.Validators.Base @identity = 'Vulgarity' constructor: -> super validate: -> return if not @val? switch typeof @val when 'string' vulgarWord = this._getVulgarWord() if ///#{vulgarWord}///i.exec @val this._addErrorMessage() else return else throw new TypeError "Vulgarity validator is applicable only for strings and #{@attr} isn't." _addErrorMessage: -> message = App.I18n[App.Env.loco.getLocale()].errors.messages.vulgarity @obj.addErrorMessage message, for: @attr _getVulgarWord: -> switch App.Env.loco.getLocale() when 'pl' then 'kurwa' when 'en' then 'fuck'
Version data entries
20 entries across 20 versions & 1 rubygems