Class: Rack::WebProfiler::Collector::View

Inherits:
View
  • Object
show all
Defined in:
lib/rack/web_profiler/collector.rb

Overview

View

Defined Under Namespace

Modules: Helpers Classes: Context

Instance Method Summary collapse

Methods inherited from View

#initialize, #result

Constructor Details

This class inherits a constructor from Rack::WebProfiler::View

Instance Method Details

#contextObject



174
175
176
# File 'lib/rack/web_profiler/collector.rb', line 174

def context
  @context ||= Context.new
end

#read_template(template) ⇒ String

Read a template. Returns file content if template is a file path.

Parameters:

  • template (String)

    template file path or content

Returns:

  • (String)


183
184
185
186
187
188
# File 'lib/rack/web_profiler/collector.rb', line 183

def read_template(template)
  unless template.empty?
    return ::File.read(template) if ::File.exist?(template)
  end
  template
end