Sha256: ea5ac6e30ed856eca3cdfca297d51962737983fd70aba06245e416cfd5c5bf75

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require 'neapolitan/factory'

module Neapolitan

  # A Part is the section of a page. Pages can be segmented into
  # parts using the '--- FORMAT' notation.
  class Part

    # Markup format (html, rdoc, markdown, textile)
    attr :formats

    # Body of text as given in the part.
    attr :text

    #
    def initialize(text, *formats)
      @text    = text
      @formats = formats
    end

    #
    def render(data, &block)
      formats.inject(text) do |rendering, format|
        factory.render(format, rendering, data, &block)
      end
    end

    #
    def factory
      Factory
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neapolitan-0.2.0 lib/neapolitan/part.rb