class Boxify::SpaceCollection

Attributes

spaces[R]

Public Class Methods

find_spaces_within_space(space:, box:) click to toggle source
# File lib/boxify/space.rb, line 23
def self.find_spaces_within_space(space:, box:)
  spaces = []

  if space.depth - box.depth > 0
    spaces.push(Space.new(depth: space.depth - box.depth,
                          width: space.width,
                          height: box.height))
  end

  if space.width - box.width > 0
    spaces.push(Space.new(depth: box.depth,
                          width: space.width - box.width,
                          height: box.height))
  end

  new(spaces: spaces)
end
new(spaces:) click to toggle source
# File lib/boxify/space.rb, line 19
def initialize(spaces:)
  @spaces = spaces
end