Module: Prawn::Chunkable

Included in:
Canvas
Defined in:
lib/prawn/chunkable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



33
34
35
# File 'lib/prawn/chunkable.rb', line 33

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#chunk(*a, &b) ⇒ Object



3
4
5
# File 'lib/prawn/chunkable.rb', line 3

def chunk(*a, &b)
  Prawn::Core::Chunk.new(*a, &b)
end

#find_chunks(params) ⇒ Object



7
8
9
10
11
# File 'lib/prawn/chunkable.rb', line 7

def find_chunks(params)
  if params[:command]
    chunks.select { |c| c.command == params[:command] }
  end
end

#to_pdfObject



13
14
15
16
17
18
19
# File 'lib/prawn/chunkable.rb', line 13

def to_pdf
  rendered = @chunks.map do |chunk| 
    chunk.to_pdf
  end
  
  rendered.join("\n")
end