Module: PLU
- Included in:
- String
- Defined in:
- lib/gtin_extras/plu.rb
Overview
String validation for PLU codes Ref: www.ifpsglobal.com/Identification/PLU-Codes
Instance Method Summary collapse
Instance Method Details
#plu? ⇒ Boolean
4 5 6 7 8 9 10 11 12 |
# File 'lib/gtin_extras/plu.rb', line 4 def plu? return false unless [4, 5].include?(length) int = to_i return false unless int.to_s == to_s return true if (3000..4999).cover? int return true if (83_000..84_999).cover? int return true if (93_000..94_999).cover? int # organic produce false end |