Sha256: ff70626bf4fcd0de35e5c060768a6ae7993589481784a5444980867e9fd58721
Contents?: true
Size: 785 Bytes
Versions: 1
Compression:
Stored size: 785 Bytes
Contents
# frozen_string_literal: true require 'measured' module Physical class Box < Cuboid DEFAULT_LENGTH = BigDecimal::INFINITY attr_reader :inner_dimensions, :inner_length, :inner_width, :inner_height def initialize(inner_dimensions: [], **args) super args @inner_dimensions = fill_dimensions(Types::Dimensions[inner_dimensions]) @inner_length, @inner_width, @inner_height = *@inner_dimensions.reverse end alias :inner_x :inner_length alias :inner_y :inner_width alias :inner_z :inner_height alias :inner_depth :inner_height def inner_volume Measured::Volume( inner_dimensions.map { |d| d.convert_to(:cm).value }.reduce(1, &:*), :ml ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
physical-0.2.0 | lib/physical/box.rb |