lib/sprockets/helpers.rb in sprockets-helpers-0.7.0 vs lib/sprockets/helpers.rb in sprockets-helpers-0.7.1
- old
+ new
@@ -47,14 +47,24 @@
# Convience method for configuring Sprockets::Helpers.
def configure
yield self
end
+
+ # Hack to ensure methods from Sprockets::Helpers override the
+ # methods of Sprockets::Context when included.
+ def append_features(context) # :nodoc:
+ context.class_eval do
+ Helpers.public_instance_methods.each do |method|
+ remove_method(method) if method_defined?(method)
+ end
+ end
+
+ super(context)
+ end
end
- end
- class Context
# Returns the path to an asset either in the Sprockets environment
# or the public directory. External URIs are untouched.
#
# ==== Options
#
@@ -271,7 +281,11 @@
# Defaults to Sprockets::Helpers.environment or the envrionment
# returned by #environment.
def assets_environment
Helpers.environment || environment
end
+ end
+
+ class Context
+ include Helpers
end
end