Sha256: 276ed4f12df0b1869e2762183fa4e423d75f0a7bd68f81ac42565922443e9be8

Contents?: true

Size: 503 Bytes

Versions: 3

Compression:

Stored size: 503 Bytes

Contents

require_relative "../lib/canned_tuna"

class Box < CannedTuna::Component
  template do
    bounding_box([0, cursor - 100], width: width, height: height) do
      outlet
      draw_border
    end
  end

  attr_reader :width, :height

  def initialize(width: 100, height: 100)
    @width, @height = width, height
  end

  def draw_border
    transparent(0.5) { stroke_bounds }
  end
end

Prawn::Document.generate("simple.pdf") do
  draw Box, width: 200, height: 100 do
    text "Inside the box"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
canned_tuna-0.0.8 example/simple.rb
canned_tuna-0.0.7 example/simple.rb
canned_tuna-0.0.6 example/simple.rb