Class: Bureaucrat::Validators::MaxLengthValidator

Inherits:
BaseValidator
  • Object
show all
Defined in:
lib/bureaucrat/validators.rb

Instance Method Summary collapse

Methods inherited from BaseValidator

#call, #initialize

Constructor Details

This class inherits a constructor from Bureaucrat::Validators::BaseValidator

Instance Method Details

#clean(x) ⇒ Object



158
159
160
# File 'lib/bureaucrat/validators.rb', line 158

def clean(x)
  x.length
end

#codeObject



150
151
152
# File 'lib/bureaucrat/validators.rb', line 150

def code
  :max_length
end

#compare(a, b) ⇒ Object



154
155
156
# File 'lib/bureaucrat/validators.rb', line 154

def compare(a, b)
  a > b
end

#messageObject



146
147
148
# File 'lib/bureaucrat/validators.rb', line 146

def message
  'Ensure this value has at most %(limit_value)d characters (it has %(show_value)d).'
end