Sha256: 51600c89d2f5c1a6b160ec06f91a3aff3d0b8db7e86691e96c5e51a79c94036a

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8

module Prawn
  
  # The Prawn::ExampleSection class is a utility class to handle sections
  # of related examples within an ExamplePackage
  #
  class ExampleSection
    attr_reader :name
    
    def initialize(package, name)
      @package  = package
      @name     = name
      @examples = []
    end
    
    # Stores a new ExampleFile in the examples list
    #
    def example(filename, options={})
      @examples << ExampleFile.new(self, "#{filename}.rb", options)
    end

    # Returns this example's package original folder name
    #
    def folder_name
      @package.folder_name
    end
    
    # Returns the human friendly version of this section's package name
    #
    def package_name
      @package.name
    end
    
    # Renders the section to a pdf and iterates the examples list delegating the
    # examples to be rendered as well
    #
    def render(pdf)
      pdf.render_section(self)
      
      @examples.each do |example|
        example.render(pdf)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-1.0.0 manual/example_section.rb
prawn-0.15.0 manual/example_section.rb
prawn-0.14.0 manual/example_section.rb
prawn-0.13.2 manual/example_section.rb
prawn-0.13.1 manual/example_section.rb
prawn-0.13.0 manual/example_section.rb
prawn-1.0.0.rc2 manual/example_section.rb
nurettin-prawn-1.0.0.rc1 manual/example_section.rb