Sha256: af34b6c018fe389491170e8259af05c9cb6e3483be0ccc6e096c570576c36ce3

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scrivener-contrib-1.0.0 lib/scrivener/contrib.rb