Sha256: 0d7d4596f911744f10a8f82d2261d046d99e016156a22411e3856c4481d1d04b

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

require 'ostruct'
require 'deas-erbtags/utils'
require 'deas-erbtags/tag'

module Factory

  def self.template(*included_modules)
    template_class = Class.new do
      include *included_modules

      attr_reader :_out_buf
      def initialize
        @_out_buf = ""
      end

      # he expected API for the Deas template scope to access erb settings
      def sinatra_call
        OpenStruct.new({
          :settings => OpenStruct.new({
            :erb => { :outvar => '@_out_buf' }
          })
        })
      end
    end

    template_class.new
  end

  def self.html_attrs(opts)
    Deas::ErbTags::Utils.html_attrs(opts)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deas-erbtags-0.2.0 test/support/factory.rb