Sha256: aea2c13723197a9b9179baee43492861cf05fa991ea7433eba13f1ed58c32c6e

Contents?: true

Size: 300 Bytes

Versions: 1

Compression:

Stored size: 300 Bytes

Contents

module PolishValidators
  class IbanValidator
    def initialize(iban)
      @iban = iban.to_s
    end

    def valid?
      return unless @iban =~ /\APL[0-9]{26}|[0-9]{26}\Z/

      @iban.gsub!(/PL/, '')
      @iban = "#{@iban[2..-1]}2521#{@iban[0..1]}".to_i
      @iban % 97 == 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polish_validators-1.0.1 lib/polish_validators/iban_validator.rb