class SvgDrawer::Cell

Public Instance Methods

_draw(parent) click to toggle source

See Row#draw for info on col_width and row_height

@param parent [Rasem::SVGTagWithParent] @param col_width [Integer] Table-wide max colum width @param row_height [Integer] Table-wide max row height @return [Rasem::SVGTagWithParent]

# File lib/svg_drawer/table/cell.rb, line 62
def _draw(parent)
  Utils::RasemWrapper.group(parent, class: param(:class), id: param(:id)) do |cell_group|
    draw_border(cell_group)
    @content.draw(cell_group, debug: @debug)
  end
end
circle(center, radius, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 46
def circle(center, radius, params = {})
  @content = Circle.new(center, radius, params.merge(inherited: child_params))
end
content(element = nil) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 19
def content(element = nil)
  return @content unless element
  raise TypeError, 'Argument must to respond to #draw' unless element.respond_to?(:draw)
  element.update_params!(inherited: child_params)
  @content = element
end
height() click to toggle source
# File lib/svg_drawer/table/cell.rb, line 9
def height
  return @height if @height
  ensure_complete!
  @height = [param(:height, 0), @content.height].max
end
image(href, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 50
def image(href, params = {})
  @content = Image.new(href, params.merge(inherited: child_params))
end
incomplete() click to toggle source
# File lib/svg_drawer/table/cell.rb, line 15
def incomplete
  @content.nil? ? self : @content.incomplete
end
line(points, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 42
def line(points, params = {})
  @content = Line.new(points, params.merge(inherited: child_params))
end
multipolyline(strokes, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 38
def multipolyline(strokes, params = {})
  @content = Multipolyline.new(strokes, params.merge(inherited: child_params))
end
path(path_components, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 30
def path(path_components, params = {})
  @content = Path.new(path_components, params.merge(inherited: child_params))
end
polyline(points, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 34
def polyline(points, params = {})
  @content = Polyline.new(points, params.merge(inherited: child_params))
end
text_box(text, params = {}) click to toggle source
# File lib/svg_drawer/table/cell.rb, line 26
def text_box(text, params = {})
  @content = TextBox.new(text, params.merge(inherited: child_params))
end
width() click to toggle source
# File lib/svg_drawer/table/cell.rb, line 3
def width
  return @width if @width
  ensure_complete!
  @width = [param(:width, 0), @content.width].max
end