Permalink
Browse files

Deprecate asset_path and asset_url with two arguments

  • Loading branch information...
1 parent 7cd8722 commit ae7e785e67986389195067ba990653ebb5829b32 Rafael Mendonça França committed Oct 27, 2012
Showing with 24 additions and 11 deletions.
  1. +24 −11 lib/sass/rails/helpers.rb
View
35 lib/sass/rails/helpers.rb
@@ -1,17 +1,30 @@
require 'sprockets/sass_functions'
-
-module Sass
- module Rails
- module Helpers
- def asset_data_url(path)
- Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
- end
- end
- end
-end
+require 'active_support/deprecation'
module Sprockets
module SassFunctions
- include Sass::Rails::Helpers
+ if instance_methods.map(&:to_sym).include?(:asset_path)
+ undef_method :asset_path
+ end
+
+ def asset_path(path, kind = nil)
+ ActiveSupport::Deprecation.warn "asset_path with two arguments is deprecated. Use asset_path(#{path}) instead." if kind
+
+ Sass::Script::String.new(sprockets_context.asset_path(path.value), :string)
+ end
+
+ if instance_methods.map(&:to_sym).include?(:asset_url)
+ undef_method :asset_url
+ end
+
+ def asset_url(path, kind = nil)
+ ActiveSupport::Deprecation.warn "asset_url with two arguments is deprecated. Use asset_url(#{path}) instead." if kind
+
+ Sass::Script::String.new("url(" + sprockets_context.asset_path(path.value) + ")")
+ end
+
+ def asset_data_url(path)
+ Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
+ end
end
end

0 comments on commit ae7e785

Please sign in to comment.