def distribute(type = :vertical, params = {})
      return 0 if selected.length == 0

      margins = params[:margins]
      margin = params[:margin] || 0
      current_end = nil

      selected.each_with_index do |view, i|
        rect = view.rmq.frame

        view_margin = if (margins && margins[i])
          margins[i]
        else
          margin
        end

        t = rect.top
        l = rect.left

        if type == :vertical
          current_end = (rect.top - view_margin) unless current_end
          t = current_end + view_margin
          current_end = t + rect.height
        else
          current_end = (rect.left - view_margin) unless current_end
          l = current_end + view_margin
          current_end = l + rect.width
        end

        view.rmq.layout(l: l, t: t)
      end

      self
    end
def distribute(type = :vertical, params = {})
      return 0 if selected.length == 0

      margins = params[:margins]
      margin = params[:margin] || 0
      current_end = nil

      selected.each_with_index do |view, i|
        rect = view.rmq.frame

        view_margin = if (margins && margins[i])
          margins[i]
        else
          margin
        end

        t = rect.top
        l = rect.left

        if type == :vertical
          current_end = (rect.top - view_margin) unless current_end
          t = current_end + view_margin
          current_end = t + rect.height
        else
          current_end = (rect.left - view_margin) unless current_end
          l = current_end + view_margin
          current_end = l + rect.width
        end

        view.rmq.layout(l: l, t: t)
      end

      self
    end
@example
   rmq(UIButton).distribute
   rmq(UIButton).distribute(:vertical)
   rmq(UIButton).distribute(:horizontal)
   rmq(UIButton).distribute(:vertical, margin: 20)
   rmq(my_view, my_other_view, third_view).distribute(:vertical, margin: 10)
   rmq(UIButton).distribute(:vertical, margins: [5,5,10,5,10,5,10,20])

 @return [RMQ]