lib/validates_cpf.rb in validates_cpf-1.1.3 vs lib/validates_cpf.rb in validates_cpf-2.0.0.rc1

- old
+ new

@@ -1,12 +1,6 @@ -require "validates_cpf/cpf" +require 'cpf_validator' +require 'require_a_valid_cpf_matcher' if defined?(::Shoulda) -#Rspec Matchers -require "validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher" if defined?(::Shoulda) -require "validates_cpf/remarkable/require_a_valid_cpf_matcher" if defined?(::Remarkable) - -class CpfValidator < ActiveModel::EachValidator - def validate_each(record, attribute, value) - key = :"activerecord.errors.models.#{record.class.name.downcase}.attributes.#{attribute.to_s}.invalid" - record.errors[attribute] << I18n.t(key, :default => :"activerecord.errors.messages.invalid") unless CPF.new(value).valid? - end +module ValidatesCpf + autoload :Cpf, 'validates_cpf/cpf' end \ No newline at end of file