Class: Prawn::Graphics::CellBlock
- Inherits:
-
Object
- Object
- Prawn::Graphics::CellBlock
- Defined in:
- lib/prawn/graphics/cell.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #<<(cell) ⇒ Object
- #border ⇒ Object
- #border_style ⇒ Object
- #border_style=(s) ⇒ Object
- #draw ⇒ Object
-
#initialize(document) ⇒ CellBlock
constructor
Not sure if this class is something I want to expose in the public API.
Constructor Details
#initialize(document) ⇒ CellBlock
Not sure if this class is something I want to expose in the public API.
184 185 186 187 188 189 |
# File 'lib/prawn/graphics/cell.rb', line 184 def initialize(document) @document = document @cells = [] @width = 0 @height = 0 end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
192 193 194 |
# File 'lib/prawn/graphics/cell.rb', line 192 def background_color @background_color end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
191 192 193 |
# File 'lib/prawn/graphics/cell.rb', line 191 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
191 192 193 |
# File 'lib/prawn/graphics/cell.rb', line 191 def width @width end |
Instance Method Details
#<<(cell) ⇒ Object
194 195 196 197 198 199 |
# File 'lib/prawn/graphics/cell.rb', line 194 def <<(cell) @cells << cell @height = cell.height if cell.height > @height @width += cell.width self end |
#border ⇒ Object
217 218 219 |
# File 'lib/prawn/graphics/cell.rb', line 217 def border @cells[0].border end |
#border_style ⇒ Object
225 226 227 |
# File 'lib/prawn/graphics/cell.rb', line 225 def border_style @cells[0].border_style end |
#border_style=(s) ⇒ Object
221 222 223 |
# File 'lib/prawn/graphics/cell.rb', line 221 def border_style=(s) @cells.each { |e| e.border_style = s } end |
#draw ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/prawn/graphics/cell.rb', line 201 def draw y = @document.y x = @document.bounds.absolute_left @cells.each do |e| e.point = [x - @document.bounds.absolute_left, y - @document.bounds.absolute_bottom] e.height = @height e.background_color ||= @background_color e.draw x += e.width end @document.y = y - @height end |