use instance hooks provided by hooks instead of changing the gem’s source

This commit is contained in:
Nico Hagenburger 2014-02-02 11:12:57 +01:00
parent 247a152d39
commit 2ad91339bb
4 changed files with 9 additions and 7 deletions

View file

@ -33,6 +33,7 @@ module Middleman
# Uses callbacks
include Hooks
include Hooks::InstanceHooks
# Before request hook
define_hook :before
@ -240,5 +241,11 @@ module Middleman
end
alias :inspect :to_s # Ruby 2.0 calls inspect for NoMethodError instead of to_s
# Hooks clones _hooks from the class to the instance.
# https://github.com/apotonick/hooks/blob/master/lib/hooks/instance_hooks.rb#L10
# Middleman expects the same list of hooks for class and instance hooks:
def _hooks
self.class._hooks
end
end
end