Module: Ohm::LengthValidations

Included in:
ExtraValidations
Defined in:
lib/ohm/contrib/length_validations.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) assert_max_length(att, length, error = [att, :too_long])



11
12
13
14
15
16
# File 'lib/ohm/contrib/length_validations.rb', line 11

def assert_max_length(att, length, error = [att, :too_long])
  if assert_present(att, error)
    m = send(att).to_s
    assert is_too_long?(m, length), error
  end
end

- (Object) assert_min_length(att, length, error = [att, :too_short])



4
5
6
7
8
9
# File 'lib/ohm/contrib/length_validations.rb', line 4

def assert_min_length(att, length, error = [att, :too_short])
  if assert_present(att, error)
    m = send(att).to_s
    assert is_long_enough?(m, length), error
  end
end