class Magiq::Types::InventoryID

Constants

INVENTORY_ID_RNG

Public Instance Methods

cast!() click to toggle source
# 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