require_relative "ohm" if defined?(Ohm) class Scrivener module Validations def assert_confirmation(att, error = [att, :not_confirmed]) assert(send(:"#{att}_confirmation") == send(att), error) end def assert_minimum_length(att, val, error = [att, :too_short]) assert(send(att).to_s.length >= val, error) end def assert_maximum_length(att, val, error = [att, :too_long]) assert(send(att).to_s.length <= val, error) end def assert_exact_length(att, val, error = [att, :wrong_length]) assert(send(att).to_s.length == val, error) end end end