Don't automatically load hooks

This commit is contained in:
Justin Li
2014-12-04 17:39:41 -05:00
parent c0aab820ed
commit 8c70682d6b
5 changed files with 9 additions and 12 deletions
-4
View File
@@ -41,10 +41,6 @@ module Liquid
singleton_class.send(:attr_accessor, :cache_classes)
self.cache_classes = true
def self.load_profiler_hooks
require 'liquid/profiler/hooks'
end
end
require "liquid/version"
+7 -1
View File
@@ -71,7 +71,13 @@ module Liquid
end
def self.hooks_loaded
false
@hooks_loaded
end
def self.load_hooks
return if @hooks_loaded
require 'liquid/profiler/hooks'
@hooks_loaded = true
end
def self.profile_token_render(token)
-6
View File
@@ -1,10 +1,4 @@
module Liquid
class Profiler
def self.hooks_loaded
true
end
end
class BlockBody
def render_token_with_profiling(token, context)
Profiler.profile_token_render(token) do
+1 -1
View File
@@ -250,7 +250,7 @@ module Liquid
def with_profiling
if @profiling && !@options[:included]
Liquid.load_profiler_hooks unless Profiler.hooks_loaded
raise "Profiler hooks not loaded, call Liquid::Profiler.load_hooks first" unless Profiler.hooks_loaded
@profiler = Profiler.new
@profiler.start
+1
View File
@@ -12,6 +12,7 @@ if env_mode = ENV['LIQUID_PARSER_MODE']
mode = env_mode.to_sym
end
Liquid::Template.error_mode = mode
Liquid::Profiler.load_hooks
if Minitest.const_defined?('Test')
# We're on Minitest 5+. Nothing to do here.