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.4.10 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.9 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.8 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.7 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.6 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.5 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.4 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.3 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.2 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.1 lib/friendly_shipping/shipment_options.rb
friendly_shipping-0.4.0 lib/friendly_shipping/shipment_options.rb