lib/slim-grunt-helpers/models/usemin.rb in slim-grunt-helpers-0.2.0 vs lib/slim-grunt-helpers/models/usemin.rb in slim-grunt-helpers-0.2.1
- old
+ new
@@ -17,11 +17,11 @@
end
alias_method :add, :<<
alias_method :include, :<<
def require(path, options={})
- self.include(path, options) unless @links.include? path.to_s
+ self.include(path, options) unless file_already_included? path
end
def each
@links.each { |link| yield(transform_link(link)) }
end
@@ -49,9 +49,16 @@
protected
def transform_link(link)
raise NotImplementedError, 'This method must be implemented in child classes'
+ end
+
+ private
+
+ def file_already_included?(path)
+ path = path.to_s
+ @links.find { |link| link[:path] == path }
end
end
end
\ No newline at end of file