class Uh::Layout::View

Attributes

columns[R]
geo[R]
id[R]

Public Class Methods

new(id, geo) click to toggle source
# File lib/uh/layout/view.rb, line 16
def initialize id, geo
  unless id.kind_of? String
    fail ArgumentError, "expect `id' to be a String, #{id.class} given"
  end
  @id       = id
  @geo      = geo.dup
  @columns  = Container.new
end

Public Instance Methods

arrange_columns() click to toggle source
# File lib/uh/layout/view.rb, line 47
def arrange_columns
  @columns.remove &:empty?
  arranger.arrange
  @columns.each &:arrange_clients
end
arranger() click to toggle source
# File lib/uh/layout/view.rb, line 43
def arranger
  Arrangers::FixedWidth.new @columns, @geo
end
clients() click to toggle source
# File lib/uh/layout/view.rb, line 29
def clients
  @columns.inject([]) { |m, column| m + column.clients }
end
current_column_or_create() click to toggle source
# File lib/uh/layout/view.rb, line 37
def current_column_or_create
  current_column or Column.new(@geo).tap do |column|
    @columns << column
  end
end
hide() click to toggle source
# File lib/uh/layout/view.rb, line 53
def hide
  clients.each &:hide
end
include?(client) click to toggle source
# File lib/uh/layout/view.rb, line 33
def include? client
  @columns.any? { |column| column.include? client }
end
to_s() click to toggle source
# File lib/uh/layout/view.rb, line 25
def to_s
  "VIEW ##{@id}, geo: #{@geo}"
end