Sha256: 42847011e998c1a56d6b35215ed6621bbf37ca096bcc66834526f5b6fc5f1ecb

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

require 'tilt'
require 'valise'

module RhetButler
  class HTMLGenerator
    class Presentation
      def initialize(configuration)
        @author_name = configuration.author
        @title = configuration.title
        @description = configuration.description
      end

      attr_accessor :author_name, :title, :description
    end

    class RenderFacade
      def initialize(templates, item)
        @templates = templates
        @item = item
      end

      def method_missing(name, *args, &block)
        @item.__send__(name, *args, &block)
      end

      def render(path, item=nil, locals=nil)
        scope = if(item.nil?)
          self
        else
          self.class.new(@templates, item)
        end
        @templates.find(path).contents.render(scope || self, locals || {})
      end
    end

    def initialize(configuration, templates)
      @impress_config = configuration.impress_config
      @templates = templates
      @root_step
      @presentation = Presentation.new(configuration)
    end

    attr_accessor :root_step, :presentation, :impress_config

    def render(template, item=nil)
      RenderFacade.new(@templates, item || self).render(template)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rhet-butler-0.14.1 lib/rhet-butler/html-generator.rb
rhet-butler-0.14.0 lib/rhet-butler/html-generator.rb
rhet-butler-0.13.0 lib/rhet-butler/html-generator.rb
rhet-butler-0.12.1 lib/rhet-butler/html-generator.rb
rhet-butler-0.11.1 lib/rhet-butler/html-generator.rb
rhet-butler-0.11.0 lib/rhet-butler/html-generator.rb
rhet-butler-0.10.0 lib/rhet-butler/html-generator.rb
rhet-butler-0.9.0 lib/rhet-butler/html-generator.rb