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
- #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.
186 187 188 189 190 191 |
# File 'lib/prawn/graphics/cell.rb', line 186 def initialize(document) @document = document @cells = [] @width = 0 @height = 0 end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
194 195 196 |
# File 'lib/prawn/graphics/cell.rb', line 194 def background_color @background_color end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
193 194 195 |
# File 'lib/prawn/graphics/cell.rb', line 193 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
193 194 195 |
# File 'lib/prawn/graphics/cell.rb', line 193 def width @width end |
Instance Method Details
#<<(cell) ⇒ Object
196 197 198 199 200 201 |
# File 'lib/prawn/graphics/cell.rb', line 196 def <<(cell) @cells << cell @height = cell.height if cell.height > @height @width += cell.width self end |
#align=(align) ⇒ Object
227 228 229 |
# File 'lib/prawn/graphics/cell.rb', line 227 def align=(align) @cells.each { |e| e.align = align } end |
#border_style ⇒ Object
231 232 233 |
# File 'lib/prawn/graphics/cell.rb', line 231 def border_style @cells[0].border_style end |
#border_style=(s) ⇒ Object
223 224 225 |
# File 'lib/prawn/graphics/cell.rb', line 223 def border_style=(s) @cells.each { |e| e.border_style = s } end |
#border_width ⇒ Object
219 220 221 |
# File 'lib/prawn/graphics/cell.rb', line 219 def border_width @cells[0].border_width end |
#draw ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/prawn/graphics/cell.rb', line 203 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 |