Sha256: 024f94bb558b8da303fab9e275bb2d20d284ba152d426c200d212401dcaf253e
Contents?: true
Size: 713 Bytes
Versions: 4
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
4 entries across 4 versions & 1 rubygems