Do away with InstanceMethods for CoreExtensions::Extensions

This commit is contained in:
Ben Hollis 2014-05-10 19:37:04 -07:00
parent d179343ce7
commit ef9da685de

View file

@ -47,7 +47,6 @@ module Middleman
app.config[:autoload_sprockets] = (ENV['AUTOLOAD_SPROCKETS'] == 'true') if ENV['AUTOLOAD_SPROCKETS'] app.config[:autoload_sprockets] = (ENV['AUTOLOAD_SPROCKETS'] == 'true') if ENV['AUTOLOAD_SPROCKETS']
app.extend ClassMethods app.extend ClassMethods
app.send :include, InstanceMethods
app.delegate :configure, to: :"self.class" app.delegate :configure, to: :"self.class"
end end
end end
@ -56,15 +55,13 @@ module Middleman
module ClassMethods module ClassMethods
# Add a callback to run in a specific environment # Add a callback to run in a specific environment
# #
# @param [String, Symbol] env The environment to run in # @param [String, Symbol] env The environment to run in (:build, :development)
# @return [void] # @return [void]
def configure(env, &block) def configure(env, &block)
send("#{env}_config", &block) send("#{env}_config", &block)
end end
end end
# Instance methods
module InstanceMethods
# This method is available in the project's `config.rb`. # This method is available in the project's `config.rb`.
# It takes a underscore-separated symbol, finds the appropriate # It takes a underscore-separated symbol, finds the appropriate
# feature module and includes it. # feature module and includes it.
@ -170,7 +167,7 @@ module Middleman
::Middleman::Extension.activated_extension(klass) ::Middleman::Extension.activated_extension(klass)
end end
end
end end
end end
end end