Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def valid_NIP?(nip) return false if nip.size != 10 weights = [6, 5, 7, 2, 3, 4, 5, 6, 7] nip = nip.split(//).map {|d| d.to_i } checksum = 0 weights.each_with_index {|w, i| checksum += w * nip[i] } return checksum % 11 % 10 == nip.last end
This paste will be private.
From the Design Piracy series on my blog: