lib/physical/cuboid.rb in physical-0.2.0 vs lib/physical/cuboid.rb in physical-0.3.0

- old
+ new

@@ -9,19 +9,14 @@ def initialize(id: nil, dimensions: [], weight: Measured::Weight(0, :g), properties: {}) @id = id || SecureRandom.uuid @weight = Types::Weight[weight] @dimensions = [] @dimensions = fill_dimensions(Types::Dimensions[dimensions]) - @length, @width, @height = *@dimensions.reverse + @length, @width, @height = *@dimensions @properties = properties end - alias :x :length - alias :y :width - alias :z :height - alias :depth :height - def volume Measured::Volume(dimensions.map { |d| d.convert_to(:cm).value }.reduce(1, &:*), :ml) end def ==(other) @@ -31,9 +26,9 @@ private def fill_dimensions(dimensions) dimensions.fill(dimensions.length..2) do |index| @dimensions[index] || Measured::Length(self.class::DEFAULT_LENGTH, :cm) - end.sort + end end end end