Sha256: 23b10ae717e4fb8ecdf856a720cad242edfcf51efecebba3fe4d0f0ae4fe793c
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module FriendlyShipping # Options for structures (pallets, skids, etc) in a shipment. class StructureOptions # @return [Object] unique identifier for this set of options attr_reader :structure_id # @param structure_id [Object] unique identifier for this set of options # @param package_options [Array<PackageOptions>] the options for packages in this structure # @param package_options_class [Class] the class to use for package options when none are provided def initialize( structure_id:, package_options: [], package_options_class: PackageOptions ) @structure_id = structure_id @package_options = package_options @package_options_class = package_options_class end # @param package [#id] the package for which to get options # @return [PackageOptions] 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 # @return [Array<PackageOptions>] attr_reader :package_options # @return [Class] attr_reader :package_options_class end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
friendly_shipping-0.9.0 | lib/friendly_shipping/structure_options.rb |