From f4be1cabfdedb4213ffca5c05c81d02aae0b05f0 Mon Sep 17 00:00:00 2001 From: Jonathan Siegel Date: Mon, 29 Nov 2010 18:55:45 +0000 Subject: [PATCH] 1.8.7 compat --- lib/foto_verite/package.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/foto_verite/package.rb b/lib/foto_verite/package.rb index 8de9628..aa06991 100644 --- a/lib/foto_verite/package.rb +++ b/lib/foto_verite/package.rb @@ -45,18 +45,18 @@ def cylinder? def ounces(options={}) case options[:type] - when *[nil,:actual]; @ounces ||= grams(options) * OUNCES_IN_A_GRAM - when *[:volumetric,:dimensional]; @volumetric_ounces ||= grams(options) * OUNCES_IN_A_GRAM - when :billable; @billable_ounces ||= [ounces,ounces(:type => :volumetric)].max + when *[nil,:actual] then @ounces ||= grams(options) * OUNCES_IN_A_GRAM + when *[:volumetric,:dimensional] then @volumetric_ounces ||= grams(options) * OUNCES_IN_A_GRAM + when :billable then @billable_ounces ||= [ounces,ounces(:type => :volumetric)].max end end alias_method :oz, :ounces def grams(options={}) case options[:type] - when *[nil,:actual]; @grams ||= ounces(options) * GRAMS_IN_AN_OUNCE - when *[:volumetric,:dimensional]; @volumetric_grams ||= centimetres(:box_volume) / 6.0 - when :billable; [grams,grams(:type => :volumetric)].max + when *[nil,:actual] then @grams ||= ounces(options) * GRAMS_IN_AN_OUNCE + when *[:volumetric,:dimensional] then @volumetric_grams ||= centimetres(:box_volume) / 6.0 + when :billable then [grams,grams(:type => :volumetric)].max end end alias_method :g, :grams @@ -106,14 +106,14 @@ def self.cents_from(money) def measure(measurement, ary) case measurement - when Fixnum; ary[measurement] - when *[:x,:max,:length,:long]; ary[2] - when *[:y,:mid,:width,:wide]; ary[1] - when *[:z,:min,:height,:depth,:high,:deep]; ary[0] + when Fixnum then ary[measurement] + when *[:x,:max,:length,:long] then ary[2] + when *[:y,:mid,:width,:wide] then ary[1] + when *[:z,:min,:height,:depth,:high,:deep] then ary[0] when *[:girth,:around,:circumference] self.cylinder? ? (Math::PI * (ary[0] + ary[1]) / 2) : (2 * ary[0]) + (2 * ary[1]) - when :volume; self.cylinder? ? (Math::PI * (ary[0] + ary[1]) / 4)**2 * ary[2] : measure(:box_volume,ary) - when :box_volume; ary[0] * ary[1] * ary[2] + when :volume then self.cylinder? ? (Math::PI * (ary[0] + ary[1]) / 4)**2 * ary[2] : measure(:box_volume,ary) + when :box_volume then ary[0] * ary[1] * ary[2] end end