Sha256: d1012061717de00be11b3160d4e1d31f9859a629aef6609697fe7e025cee3989

Contents?: true

Size: 354 Bytes

Versions: 3

Compression:

Stored size: 354 Bytes

Contents

require "cuba/rum"
require "tilt"

module Cuba
  class Ron < Rum
    def _cache
      Thread.current[:_cache] ||= Tilt::Cache.new
    end

    def render(template, locals = {})
      _cache.fetch(template, locals) {
        Tilt.new(template)
      }.render(self, locals)
    end

    def session
      @session ||= env['rack.session']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuba-0.3.0 lib/cuba/ron.rb
cuba-0.2.0 lib/cuba/ron.rb
cuba-0.1.0 lib/cuba/ron.rb