Permalink
Browse files

Some ruby 1.9 love

  • Loading branch information...
1 parent a848c35 commit 923ee206009ca6c75abd6679152605947a58b0a0 @josh josh committed Dec 11, 2013
@@ -13,7 +13,7 @@ class BundledAsset < Asset
def initialize(environment, logical_path, pathname)
super(environment, logical_path, pathname)
- @processed_asset = environment.find_asset(pathname, :bundle => false)
+ @processed_asset = environment.find_asset(pathname, bundle: false)
@required_assets = @processed_asset.required_assets
@dependency_paths = @processed_asset.dependency_paths
@@ -22,8 +22,8 @@ def initialize(environment, logical_path, pathname)
# Run bundle processors on concatenated source
context = environment.context_class.new(environment, logical_path, pathname)
- @source = context.evaluate(pathname, :data => @source,
- :processors => environment.bundle_processors(content_type))
+ @source = context.evaluate(pathname, data: @source,
+ processors: environment.bundle_processors(content_type))
@mtime = (to_a + @dependency_paths).map(&:mtime).max
@length = Rack::Utils.bytesize(source)
@@ -34,7 +34,7 @@ def initialize(environment, logical_path, pathname)
def init_with(environment, coder)
super
- @processed_asset = environment.find_asset(pathname, :bundle => false)
+ @processed_asset = environment.find_asset(pathname, bundle: false)
@required_assets = @processed_asset.required_assets
if @processed_asset.dependency_digest != coder['required_assets_digest']
@@ -105,7 +105,7 @@ def resolve(path, options = {}, &block)
raise FileNotFound, "couldn't find file '#{path}'"
else
- environment.resolve(path, {:base_path => self.pathname.dirname}.merge(options), &block)
+ environment.resolve(path, {base_path: self.pathname.dirname}.merge(options), &block)
end
end
@@ -143,7 +143,7 @@ def depend_on_asset(path)
# <%= require_asset "#{framework}.js" %>
#
def require_asset(path)
- pathname = resolve(path, :content_type => :self)
+ pathname = resolve(path, content_type: :self)
depend_on_asset(pathname)
@_required_paths << pathname.to_s
nil
@@ -153,7 +153,7 @@ def require_asset(path)
# `path` must be an asset which may or may not already be included
# in the bundle.
def stub_asset(path)
- @_stubbed_assets << resolve(path, :content_type => :self).to_s
+ @_stubbed_assets << resolve(path, content_type: :self).to_s
nil
end
@@ -243,32 +243,32 @@ def asset_path(path, options = {})
# Expand logical image asset path.
def image_path(path)
- asset_path(path, :type => :image)
+ asset_path(path, type: :image)
end
# Expand logical video asset path.
def video_path(path)
- asset_path(path, :type => :video)
+ asset_path(path, type: :video)
end
# Expand logical audio asset path.
def audio_path(path)
- asset_path(path, :type => :audio)
+ asset_path(path, type: :audio)
end
# Expand logical font asset path.
def font_path(path)
- asset_path(path, :type => :font)
+ asset_path(path, type: :font)
end
# Expand logical javascript asset path.
def javascript_path(path)
- asset_path(path, :type => :javascript)
+ asset_path(path, type: :javascript)
end
# Expand logical stylesheet asset path.
def stylesheet_path(path)
- asset_path(path, :type => :stylesheet)
+ asset_path(path, type: :stylesheet)
end
private
@@ -41,7 +41,7 @@ def init_with(environment, coder)
raise UnserializeError, "#{p} isn't in paths"
end
- p == pathname.to_s ? self : environment.find_asset(p, :bundle => false)
+ p == pathname.to_s ? self : environment.find_asset(p, bundle: false)
}
@dependency_paths = coder['dependency_paths'].map { |h|
DependencyFile.new(expand_root_path(h['path']), h['mtime'], h['digest'])
@@ -108,7 +108,7 @@ def resolve_dependencies(environment, paths)
cache[self] = true
assets << self
end
- elsif asset = environment.find_asset(path, :bundle => false)
+ elsif asset = environment.find_asset(path, bundle: false)
asset.required_assets.each do |asset_dependency|
unless cache[asset_dependency]
cache[asset_dependency] = true
@@ -129,7 +129,7 @@ def build_dependency_paths(environment, context)
assets = context._dependency_assets.flat_map do |path|
if path == self.pathname.to_s
DependencyFile.new(pathname, environment.stat(path).mtime, environment.file_digest(path).hexdigest)
- elsif asset = environment.find_asset(path, :bundle => false)
+ elsif asset = environment.find_asset(path, bundle: false)
asset.dependency_paths
end
end
@@ -9,7 +9,7 @@ def initialize(environment)
end
def _store(key, version, sha, contents)
- environment.cache_set("sass/#{key}", {:version => version, :sha => sha, :contents => contents})
+ environment.cache_set("sass/#{key}", {version: version, sha: sha, contents: contents})
end
def _retrieve(key, version, sha)
@@ -44,7 +44,7 @@ def call(env)
end
# Look up the asset.
- asset = find_asset(path, :bundle => !body_only?(env))
+ asset = find_asset(path, bundle: !body_only?(env))
# `find_asset` returns nil if the asset doesn't exist
if asset.nil?
@@ -19,10 +19,10 @@ def evaluate(context, locals, &block)
# Feature detect Uglifier 2.0 option support
if Uglifier::DEFAULTS[:copyright]
# Uglifier < 2.x
- Uglifier.new(:copyright => false).compile(data)
+ Uglifier.new(copyright: false).compile(data)
else
# Uglifier >= 2.x
- Uglifier.new(:comments => :none).compile(data)
+ Uglifier.new(comments: :none).compile(data)
end
end
end

0 comments on commit 923ee20

Please sign in to comment.