Class: Prawn::Table::CellBlock
- Inherits:
-
Object
- Object
- Prawn::Table::CellBlock
- Defined in:
- lib/prawn/table/cell.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#cells ⇒ Object
readonly
Returns the value of attribute cells.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#text_color ⇒ Object
Returns the value of attribute text_color.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #<<(cell) ⇒ Object
- #align=(align) ⇒ Object
- #border_style ⇒ Object
- #border_style=(s) ⇒ Object
- #border_width ⇒ 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.
231 232 233 234 235 236 |
# File 'lib/prawn/table/cell.rb', line 231 def initialize(document) @document = document @cells = [] @width = 0 @height = 0 end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
239 240 241 |
# File 'lib/prawn/table/cell.rb', line 239 def background_color @background_color end |
#border_color ⇒ Object
Returns the value of attribute border_color.
239 240 241 |
# File 'lib/prawn/table/cell.rb', line 239 def border_color @border_color end |
#cells ⇒ Object (readonly)
Returns the value of attribute cells.
238 239 240 |
# File 'lib/prawn/table/cell.rb', line 238 def cells @cells end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
238 239 240 |
# File 'lib/prawn/table/cell.rb', line 238 def height @height end |
#text_color ⇒ Object
Returns the value of attribute text_color.
239 240 241 |
# File 'lib/prawn/table/cell.rb', line 239 def text_color @text_color end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
238 239 240 |
# File 'lib/prawn/table/cell.rb', line 238 def width @width end |
Instance Method Details
#<<(cell) ⇒ Object
241 242 243 244 245 246 |
# File 'lib/prawn/table/cell.rb', line 241 def <<(cell) @cells << cell @height = cell.height if cell.height > @height @width += cell.width self end |
#align=(align) ⇒ Object
274 275 276 |
# File 'lib/prawn/table/cell.rb', line 274 def align=(align) @cells.each { |e| e.align = align } end |
#border_style ⇒ Object
278 279 280 |
# File 'lib/prawn/table/cell.rb', line 278 def border_style @cells[0].border_style end |
#border_style=(s) ⇒ Object
270 271 272 |
# File 'lib/prawn/table/cell.rb', line 270 def border_style=(s) @cells.each { |e| e.border_style = s } end |
#border_width ⇒ Object
266 267 268 |
# File 'lib/prawn/table/cell.rb', line 266 def border_width @cells[0].border_width end |
#draw ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/prawn/table/cell.rb', line 248 def draw y = @document.y x = @document.bounds.left_side @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.text_color ||= @text_color e.border_color ||= @border_color e.draw x += e.width end @document.y = y - @height end |