class Uh::Layout::Arrangers::FixedWidth
Constants
- DEFAULT_WIDTH
Public Class Methods
new(entries, geo, width: DEFAULT_WIDTH)
click to toggle source
# File lib/uh/layout/arrangers/fixed_width.rb, line 7 def initialize entries, geo, width: DEFAULT_WIDTH @entries = entries @geo = geo @width = width end
Public Instance Methods
arrange()
click to toggle source
# File lib/uh/layout/arrangers/fixed_width.rb, line 13 def arrange return if @entries.empty? @entries.each_with_index do |column, i| column.x = @width * i + @geo.x column.y = @geo.y column.width = @width column.height = @geo.height end @entries.last.width = @geo.width - (@entries.last.x - @geo.x) end
max_count?()
click to toggle source
# File lib/uh/layout/arrangers/fixed_width.rb, line 24 def max_count? (@geo.width / (@entries.size + 1)) < @width end