Sha256: 996fb8cb90976ffe13b637c8693052872f75c4334feaf87ba0d90bc773110311

Contents?: true

Size: 781 Bytes

Versions: 4

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

module WebConsole
  # A facade that handles template rendering and composition.
  #
  # It introduces template helpers to ease the inclusion of scripts only on
  # Rails error pages.
  class Template
    # Lets you customize the default templates folder location.
    cattr_accessor :template_paths, default: [ File.expand_path("../templates", __FILE__) ]

    def initialize(env, session)
      @env = env
      @session = session
      @mount_point = Middleware.mount_point
    end

    # Render a template (inferred from +template_paths+) as a plain string.
    def render(template)
      view = View.with_empty_template_cache.with_view_paths(template_paths, instance_values)
      view.render(template: template, layout: false)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/web-console-4.2.1/lib/web_console/template.rb
web-console-4.2.1 lib/web_console/template.rb
web-console-4.2.0 lib/web_console/template.rb
web-console-4.1.0 lib/web_console/template.rb