Class: Cards::Layouts::RowLayout

Inherits:
Object
  • Object
show all
Defined in:
lib/cards/layouts/row_layout.rb

Instance Method Summary collapse

Instance Method Details

#height(card) ⇒ Object



18
19
20
# File 'lib/cards/layouts/row_layout.rb', line 18

def height(card)
  card.children.map {|c| c.height}.max
end

#layout(card) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/cards/layouts/row_layout.rb', line 4

def layout(card)
  x = card.x
  card.children.each_with_index do |child, i|
    child.x = x
    child.y = card.y + 1
    child.layout
    x += child.width
  end
end

#width(card) ⇒ Object



14
15
16
# File 'lib/cards/layouts/row_layout.rb', line 14

def width(card)
  card.children.map {|c| c.width}.sum
end