class Prawn::ManualBuilder::ExampleSection

The Prawn::ManualBuilder::ExampleSection class is a utility class to handle sections of related examples within an ExamplePackage

Attributes

name[R]

Public Class Methods

new(package, name) click to toggle source
# File lib/prawn/manual_builder/example_section.rb, line 11
def initialize(package, name)
  @package  = package
  @name     = name
  @examples = []
end

Public Instance Methods

example(filename, options={}) click to toggle source

Stores a new ExampleFile in the examples list

# File lib/prawn/manual_builder/example_section.rb, line 19
def example(filename, options={})
  @examples << ExampleFile.new(self, "#{filename}.rb", options)
end
folder_name() click to toggle source

Returns this example's package original folder name

# File lib/prawn/manual_builder/example_section.rb, line 25
def folder_name
  @package.folder_name
end
package_name() click to toggle source

Returns the human friendly version of this section's package name

# File lib/prawn/manual_builder/example_section.rb, line 31
def package_name
  @package.name
end
render(pdf) click to toggle source

Renders the section to a pdf and iterates the examples list delegating the examples to be rendered as well

# File lib/prawn/manual_builder/example_section.rb, line 38
def render(pdf)
  pdf.render_section(self)
  
  @examples.each do |example|
    example.render(pdf)
  end
end