Class: Magiq::Types::InventoryID
Constant Summary collapse
- INVENTORY_ID_RNG =
/\A([0-9]{1,12})\-([0-9]{1,3})\Z/
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
Constructor Details
This class inherits a constructor from Magiq::Types::Type
Instance Method Details
#cast! ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/magiq/types.rb', line 115 def cast! v = raw.to_s.strip if v =~ INVENTORY_ID_RNG [$1.to_i, $2.to_i] else bad! "provided value of #{raw.inspect} is not a permitted " \ "inventory ID, it must be a product ID and store ID separated by a " \ "dash, eg: 232744-94" end end |