Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Cleanup Asset initialize arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Apr 26, 2011
1 parent 465d9b2 commit 9fa6029
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/sprockets/concatenated_asset.rb
Expand Up @@ -7,8 +7,8 @@ class ConcatenatedAsset
attr_reader :content_type, :format_extension
attr_reader :mtime, :length, :digest

def initialize(environment, pathname, engines)
engine_pathname = EnginePathname.new(pathname, engines)
def initialize(environment, pathname)
engine_pathname = EnginePathname.new(pathname, environment.engines)
@content_type = engine_pathname.content_type
@format_extension = engine_pathname.format_extension

Expand Down
8 changes: 4 additions & 4 deletions lib/sprockets/environment_index.rb
Expand Up @@ -129,15 +129,15 @@ def find_asset_in_static(logical_path)

entries.each do |filename|
if filename.to_s =~ pattern
asset = StaticAsset.new(pathname.dirname.join(filename), engines)
asset = StaticAsset.new(self, pathname.dirname.join(filename))
@static_assets[logical_path] = asset
return asset
end
end
end

if entries.include?(pathname.basename) && pathname.file?
asset = StaticAsset.new(pathname, engines)
asset = StaticAsset.new(self, pathname)
@static_assets[logical_path] = asset
return asset
end
Expand All @@ -161,9 +161,9 @@ def find_asset_in_path(logical_path)
else
if engines.concatenatable?(pathname)
logger.info "[Sprockets] #{logical_path} building"
asset = ConcatenatedAsset.new(self, pathname, engines)
asset = ConcatenatedAsset.new(self, pathname)
else
asset = StaticAsset.new(pathname, engines)
asset = StaticAsset.new(self, pathname)
end

if fingerprint && fingerprint != asset.digest
Expand Down
4 changes: 2 additions & 2 deletions lib/sprockets/static_asset.rb
Expand Up @@ -7,10 +7,10 @@ module Sprockets
class StaticAsset
attr_reader :pathname, :content_type, :mtime, :length, :digest

def initialize(pathname, engines)
def initialize(environment, pathname)
@pathname = Pathname.new(pathname)

engine_pathname = EnginePathname.new(pathname, engines)
engine_pathname = EnginePathname.new(pathname, environment.engines)
@content_type = engine_pathname.content_type

@mtime = @pathname.mtime
Expand Down
2 changes: 1 addition & 1 deletion test/test_concatenated_asset.rb
Expand Up @@ -200,7 +200,7 @@ def setup
end

def asset(logical_path)
Sprockets::ConcatenatedAsset.new(@env.index, resolve(logical_path), Sprockets::Engines.new)
Sprockets::ConcatenatedAsset.new(@env.index, resolve(logical_path))
end

def resolve(logical_path)
Expand Down

0 comments on commit 9fa6029

Please sign in to comment.