class ScoutApm::Instant::Util

Public Class Methods

read_asset(name, vars = {}) click to toggle source

reads the literal contents of the file in assets/#{name} if any vars are supplied, do a simple string substitution of the vars for their values

# File lib/scout_apm/instant/middleware.rb, line 39
def self.read_asset(name, vars = {})
  contents = File.read(File.join(File.dirname(__FILE__), "assets", name))
  if vars.any?
    vars.each_pair{|k,v| contents.gsub!(k.to_s,v.to_s)}
  end
  contents
end