Sha256: 43e4b5e084344fd93e55281e39ffa19b859568cc35b8f2fc82e4a8d0a0099fe1
Contents?: true
Size: 504 Bytes
Versions: 3
Compression:
Stored size: 504 Bytes
Contents
class Jan module Parser module_function def check_digit(code) code[-1].to_i end def body(code) code[0..-2] end def even_digits(code) code.split('').reverse.map(&:to_i).select.with_index(1){|_d, index| index.even? }.reverse end def odd_digits(code) code.split('').reverse.map(&:to_i).select.with_index(1){|_d, index| index.odd? }.reverse[0..-2] end def instore_code?(code) InstorePrefixes.include?(code[0..1]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jan-0.0.3 | lib/jan/parser.rb |
jan-0.0.2 | lib/jan/parser.rb |
jan-0.0.1 | lib/jan/parser.rb |