Sha256: 1a53e0dbf18a17a401ed8f4ba4050d95e5c033648f935ee3afd177b2a3fc41f5
Contents?: true
Size: 579 Bytes
Versions: 3
Compression:
Stored size: 579 Bytes
Contents
module Kosher # Shipping details of an offer. # # Shipping costs something (or nothing) and is subject to availability. class Shipping < Structure key :cents, :type => Integer key :currency has_one :availability # Returns whether the item ships for free. def free? cents == 0 end # Returns true if the item is available to ship. def kosher? availability.kosher? end # The shipping cost. def cost raise TypeError, "Can't render money" unless cents Money.new(cents, currency) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kosher-0.6.2 | lib/kosher/shipping.rb |
kosher-0.6.1 | lib/kosher/shipping.rb |
kosher-0.6.0 | lib/kosher/shipping.rb |