Sha256: 73f9bdec63a96cccbbf161c7e25e0ed6c32af7ebe4cc97b344be9df4f16034b3

Contents?: true

Size: 563 Bytes

Versions: 31

Compression:

Stored size: 563 Bytes

Contents

# frozen_string_literal: true

module FriendlyShipping
  class ShipmentOptions
    def initialize(
      package_options: Set.new,
      package_options_class: PackageOptions
    )
      @package_options = package_options
      @package_options_class = package_options_class
    end

    def options_for_package(package)
      package_options.detect do |package_option|
        package_option.package_id == package.id
      end || package_options_class.new(package_id: nil)
    end

    private

    attr_reader :package_options, :package_options_class
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
friendly_shipping-0.8.1 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.8.0 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.7.3 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.7.2 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.7.1 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.7.0 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.5 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.4 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.3 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.2 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.1 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.6.0 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.5.3 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.5.2 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.5.1 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.5 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.14 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.13 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.12 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.11 lib/friendly_shipping/shipment_options.rb