Sha256: 45de0ffbfb982a094d86e1c92413aa79d5a683316ea317dacb0c627bde99e0c8

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

module Prawn
  module ManualBuilder
    # The Prawn::ManualBuilder::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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
prawn-manual_builder-0.3.1 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.3.0 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.2.0 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.1.3 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.1.2 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.1.1 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.1.0 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.0.3 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.0.2 lib/prawn/manual_builder/example_section.rb
prawn-manual_builder-0.0.1 lib/prawn/manual_builder/example_section.rb