jekyll-assets 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +13 -9
  3. data/README.md +36 -10
  4. data/Rakefile +40 -0
  5. data/lib/jekyll/assets.rb +13 -10
  6. data/lib/jekyll/assets/addons.rb +7 -6
  7. data/lib/jekyll/assets/addons/processors/liquid.rb +31 -0
  8. data/lib/jekyll/assets/addons/proxies/magick.rb +10 -8
  9. data/lib/jekyll/assets/config.rb +11 -8
  10. data/lib/jekyll/assets/env.rb +33 -17
  11. data/lib/jekyll/assets/hook.rb +17 -18
  12. data/lib/jekyll/assets/hooks.rb +13 -14
  13. data/lib/jekyll/assets/hooks/context_patches.rb +2 -2
  14. data/lib/jekyll/assets/hooks/helpers.rb +1 -1
  15. data/lib/jekyll/assets/hooks/jekyll/{asset_drops.rb → drops.rb} +1 -1
  16. data/lib/jekyll/assets/hooks/jekyll/setup.rb +13 -0
  17. data/lib/jekyll/assets/hooks/jekyll/{write_assets.rb → write.rb} +0 -0
  18. data/lib/jekyll/assets/hooks/sources.rb +2 -1
  19. data/lib/jekyll/assets/liquid.rb +3 -3
  20. data/lib/jekyll/assets/liquid/drop.rb +3 -3
  21. data/lib/jekyll/assets/liquid/filters.rb +5 -12
  22. data/lib/jekyll/assets/liquid/tag.rb +31 -37
  23. data/lib/jekyll/assets/liquid/tag/defaults.rb +2 -3
  24. data/lib/jekyll/assets/liquid/tag/defaults/image.rb +5 -5
  25. data/lib/jekyll/assets/liquid/tag/parser.rb +47 -55
  26. data/lib/jekyll/assets/liquid/tag/proxied_asset.rb +6 -10
  27. data/lib/jekyll/assets/liquid/tag/proxies.rb +19 -32
  28. data/lib/jekyll/assets/logger.rb +7 -6
  29. data/lib/jekyll/assets/patches.rb +4 -4
  30. data/lib/jekyll/assets/patches/kernel.rb +1 -1
  31. data/lib/jekyll/assets/version.rb +1 -1
  32. metadata +14 -14
  33. data/lib/jekyll/assets/hooks/jekyll/ignore.rb +0 -9
  34. data/lib/jekyll/assets/hooks/jekyll/initialize.rb +0 -7
@@ -7,19 +7,18 @@ module Jekyll
7
7
  class Hook
8
8
  class UnknownHookError < RuntimeError
9
9
  def initialize(base: nil, point: nil)
10
- return super "Unknown hook base '#{base}'" if base
11
- return super "Unknown hook point '#{point}' given."
10
+ super "Unknown hook #{base ? "base" : "point"} '#{base || point}'"
12
11
  end
13
12
  end
14
13
 
15
- HookAliases = {
14
+ HOOK_ALIASES = {
16
15
  :env => {
17
16
  :post_init => :init,
18
- :pre_init => :init
17
+ :pre_init => :init
19
18
  }
20
19
  }
21
20
 
22
- HookPoints = {
21
+ HOOK_POINTS = {
23
22
  :env => [
24
23
  :init
25
24
  ]
@@ -33,10 +32,10 @@ module Jekyll
33
32
  # proc we got and then you can do as you please (such as instance eval)
34
33
  # but if you do not give us one then we simply pass the args.
35
34
 
36
- def self.trigger(base, _point, *args, &block)
35
+ def self.trigger(base, point_, *args, &block)
37
36
  raise ArgumentError, "Do not give args with a block" if args.size > 0 && block_given?
38
- if all.has_key?(base) && all[base].has_key?(_point)
39
- Set.new.merge(point(base, _point, :early)).merge(point(base, _point)).map do |v|
37
+ if all.key?(base) && all[base].key?(point_)
38
+ Set.new.merge(point(base, point_, :early)).merge(point(base, point_)).map do |v|
40
39
  block_given?? block.call(v) : v.call(*args)
41
40
  end
42
41
  end
@@ -44,25 +43,25 @@ module Jekyll
44
43
 
45
44
  #
46
45
 
47
- def self.point(base, point, _when = :late)
46
+ def self.point(base, point, when_ = :late)
48
47
  point = all[base][point] ||= {
49
- :late => Set.new,
50
- :early => Set.new
48
+ :early => Set.new,
49
+ :late => Set.new
51
50
  }
52
51
 
53
- point[_when]
52
+ point[when_]
54
53
  end
55
54
 
56
55
  #
57
56
 
58
- def self.register(base, point, _when = :late, &block)
59
- raise UnknownHookError.new(base: base) unless HookPoints.has_key?(base)
60
- point = HookAliases[base][point] if HookAliases.fetch(base, {}).has_key?(point)
61
- raise UnknownHookError.new(point: point) unless HookPoints[base].include?(point)
57
+ def self.register(base, point, when_ = :late, &block)
58
+ raise UnknownHookError, base: base unless HOOK_POINTS.key?(base)
59
+ point = HOOK_ALIASES[base][point] if HOOK_ALIASES.fetch(base, {}).key?(point)
60
+ raise UnknownHookError, point: point unless HOOK_POINTS[base].include?(point)
62
61
  all[base] ||= {}
63
62
 
64
- point(base, point, _when). \
65
- add(block)
63
+ point(base, point, when_) \
64
+ .add(block)
66
65
  end
67
66
  end
68
67
  end
@@ -2,18 +2,17 @@
2
2
  # Copyright: 2012-2015 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
- require_relative "hooks/jekyll/initialize"
6
- require_relative "hooks/jekyll/write_assets"
7
- require_relative "hooks/jekyll/asset_drops"
8
- require_relative "hooks/jekyll/ignore"
5
+ require "jekyll/assets/hooks/jekyll/drops"
6
+ require "jekyll/assets/hooks/jekyll/setup"
7
+ require "jekyll/assets/hooks/jekyll/write"
9
8
 
10
- require_relative "hooks/compression"
11
- require_relative "hooks/configuration"
12
- require_relative "hooks/context_patches"
13
- require_relative "hooks/disable_erb"
14
- require_relative "hooks/helpers"
15
- require_relative "hooks/logger"
16
- require_relative "hooks/sources"
17
- require_relative "hooks/sprockets"
18
- require_relative "hooks/version"
19
- require_relative "hooks/cache"
9
+ require "jekyll/assets/hooks/compression"
10
+ require "jekyll/assets/hooks/configuration"
11
+ require "jekyll/assets/hooks/context_patches"
12
+ require "jekyll/assets/hooks/disable_erb"
13
+ require "jekyll/assets/hooks/helpers"
14
+ require "jekyll/assets/hooks/logger"
15
+ require "jekyll/assets/hooks/sources"
16
+ require "jekyll/assets/hooks/sprockets"
17
+ require "jekyll/assets/hooks/version"
18
+ require "jekyll/assets/hooks/cache"
@@ -5,13 +5,13 @@
5
5
  Jekyll::Assets::Hook.register :env, :init do
6
6
  context_class.class_eval do
7
7
  alias_method :_old_asset_path, :asset_path
8
- def asset_path(asset, opts = {})
8
+ def asset_path(asset, _ = {})
9
9
  out = _old_asset_path asset
10
10
 
11
11
  return unless out
12
12
  path = environment.find_asset(resolve(asset))
13
13
  environment.parent.used.add(path)
14
- out
14
+ out
15
15
  end
16
16
  end
17
17
  end
@@ -7,6 +7,6 @@ require "sprockets/helpers"
7
7
  Jekyll::Assets::Hook.register :env, :init do
8
8
  Sprockets::Helpers.configure do |config|
9
9
  config.prefix = prefix_path
10
- config.digest = digest?
10
+ config.digest = digest?
11
11
  end
12
12
  end
@@ -3,5 +3,5 @@
3
3
  # Encoding: utf-8
4
4
 
5
5
  Jekyll::Hooks.register :site, :pre_render do |jekyll, payload|
6
- payload["assets"] ||= jekyll.sprockets.to_liquid_payload
6
+ payload["assets"] = jekyll.sprockets.to_liquid_payload
7
7
  end
@@ -0,0 +1,13 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2012-2015 - MIT License
3
+ # Encoding: utf-8
4
+
5
+ Jekyll::Hooks.register :site, :after_reset do |jekyll|
6
+ Jekyll::Assets::Env.new(jekyll)
7
+
8
+ jekyll.sprockets.excludes.each do |exclude|
9
+ unless jekyll.config["exclude"].grep(%r!\A#{Regexp.escape(exclude)}/?!).size > 0
10
+ jekyll.config["exclude"] << exclude
11
+ end
12
+ end
13
+ end
@@ -3,7 +3,8 @@
3
3
  # Encoding: utf-8
4
4
 
5
5
  Jekyll::Assets::Hook.register :env, :init do
6
- (asset_config["sources"] ||= []).each do |path|
6
+ asset_config["sources"] ||= []
7
+ asset_config["sources"].each do |path|
7
8
  append_path jekyll.in_source_dir(path)
8
9
  end
9
10
  end
@@ -5,9 +5,9 @@
5
5
  module Jekyll
6
6
  module Assets
7
7
  module Liquid
8
- require_relative "liquid/drop"
9
- require_relative "liquid/filters"
10
- require_relative "liquid/tag"
8
+ require "jekyll/assets/liquid/tag"
9
+ require "jekyll/assets/liquid/filters"
10
+ require "jekyll/assets/liquid/drop"
11
11
  end
12
12
  end
13
13
  end
@@ -2,7 +2,7 @@
2
2
  # Copyright: 2012-2015 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
- require "fastimage"
5
+ autoload :FastImage, "fastimage"
6
6
 
7
7
  module Jekyll
8
8
  module Assets
@@ -44,14 +44,14 @@ module Jekyll
44
44
 
45
45
  private
46
46
  def image?
47
- %(image/png image/jpeg image/gif).include?(
47
+ %W(image/png image/jpeg image/gif).include?(
48
48
  asset.content_type
49
49
  )
50
50
  end
51
51
 
52
52
  private
53
53
  def asset
54
- return @asset ||= @jekyll.sprockets.find_asset(@path)
54
+ @asset ||= @jekyll.sprockets.find_asset(@path)
55
55
  end
56
56
  end
57
57
  end
@@ -6,20 +6,13 @@ module Jekyll
6
6
  module Assets
7
7
  module Liquid
8
8
  module Filters
9
- AcceptableFilters = %W(
10
- css
11
- image
12
- asset_path
13
- stylesheet
14
- javascript
15
- style
16
- img
17
- js
18
- )
9
+ ACCEPTABLE_FILTERS = %W(css image asset_path stylesheet
10
+ javascript style img js)
19
11
 
20
- AcceptableFilters.each do |val|
12
+ ACCEPTABLE_FILTERS.each do |val|
21
13
  define_method val do |path, args = ""|
22
- Tag.send(:new, val, "#{path} #{args}", "").render(@context)
14
+ tag = Tag.send(:new, val, "#{path} #{args}", "")
15
+ tag.render(@context)
23
16
  end
24
17
  end
25
18
  end
@@ -2,21 +2,18 @@
2
2
  # Copyright: 2012-2015 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
- require "fastimage"
6
-
7
5
  module Jekyll
8
6
  module Assets
9
7
  module Liquid
10
8
  class Tag < ::Liquid::Tag
11
- require_relative "tag/proxies"
12
- require_relative "tag/proxied_asset"
13
- require_relative "tag/defaults"
14
- require_relative "tag/parser"
9
+ autoload :Proxies, "jekyll/assets/liquid/tag/proxies"
10
+ autoload :ProxiedAsset, "jekyll/assets/liquid/tag/proxied_asset"
11
+ autoload :Defaults, "jekyll/assets/liquid/tag/defaults"
12
+ autoload :Parser, "jekyll/assets/liquid/tag/parser"
15
13
  attr_reader :args
16
14
 
17
15
  class << self
18
- public \
19
- :new
16
+ public :new
20
17
  end
21
18
 
22
19
  class AssetNotFoundError < StandardError
@@ -38,15 +35,15 @@ module Jekyll
38
35
  asset
39
36
  css
40
37
  js
41
- )
38
+ ).freeze
42
39
 
43
40
  #
44
41
 
45
42
  Tags = {
46
- "css" => %Q{<link type="text/css" rel="stylesheet" href="%s"%s>},
47
- "js" => %Q{<script type="text/javascript" src="%s"%s></script>},
48
- "img" => %Q{<img src="%s"%s>}
49
- }
43
+ "css" => %{<link type="text/css" rel="stylesheet" href="%s"%s>},
44
+ "js" => %{<script type="text/javascript" src="%s"%s></script>},
45
+ "img" => %{<img src="%s"%s>}
46
+ }.freeze
50
47
 
51
48
  #
52
49
 
@@ -55,7 +52,7 @@ module Jekyll
55
52
  "stylesheet" => "css",
56
53
  "javascript" => "js",
57
54
  "style" => "css"
58
- }
55
+ }.freeze
59
56
 
60
57
  #
61
58
 
@@ -74,25 +71,24 @@ module Jekyll
74
71
  # because of a single asset change.
75
72
 
76
73
  def render(context)
77
- args = Parser.parse_liquid(@args, context)
74
+ args = @args.parse_liquid(context)
78
75
  site = context.registers[:site]
79
76
  page = context.registers.fetch(:page, {})
80
77
  sprockets = site.sprockets
81
78
  page = page["path"]
82
79
 
83
- asset = find_asset(sprockets)
80
+ asset = find_asset(args, sprockets)
84
81
  add_as_jekyll_dependency(site, sprockets, page, asset)
85
82
  process_tag(args, sprockets, asset)
86
83
  rescue => e
87
- capture_and_out_error \
88
- site, e
84
+ capture_and_out_error site, e
89
85
  end
90
86
 
91
87
  #
92
88
 
93
89
  private
94
90
  def from_alias(tag)
95
- Alias.has_key?(tag) ? Alias[tag] : tag
91
+ Alias.key?(tag) ? Alias[tag] : tag
96
92
  end
97
93
 
98
94
  #
@@ -109,20 +105,18 @@ module Jekyll
109
105
  private
110
106
  def build_html(args, sprockets, asset, path = get_path(sprockets, asset))
111
107
  if @tag == "asset_path"
112
- return path
108
+ path
113
109
 
114
110
  elsif @tag == "asset" || @tag == "asset_source"
115
- return asset.to_s
111
+ asset.to_s
116
112
 
117
- elsif args.has_key?(:data) && args[:data].has_key?(:uri)
118
- return Tags[@tag] % [
119
- asset.data_uri, Parser.to_html(args)
120
- ]
113
+ elsif args.key?(:data) && args[:data].key?(:uri)
114
+ format(Tags[@tag], asset.data_uri, \
115
+ args.to_html)
121
116
 
122
117
  else
123
- return Tags[@tag] % [
124
- path, Parser.to_html(args)
125
- ]
118
+ format(Tags[@tag], path, \
119
+ args.to_html)
126
120
  end
127
121
  end
128
122
 
@@ -130,8 +124,7 @@ module Jekyll
130
124
 
131
125
  private
132
126
  def get_path(sprockets, asset)
133
- sprockets.prefix_path(sprockets.digest?? asset.digest_path : \
134
- asset.logical_path)
127
+ sprockets.prefix_path(sprockets.digest?? asset.digest_path : asset.logical_path)
135
128
  end
136
129
 
137
130
  #
@@ -148,14 +141,15 @@ module Jekyll
148
141
  #
149
142
 
150
143
  private
151
- def find_asset(sprockets)
152
- file, _sprockets = @args[:file], @args[:sprockets] ||= {}
153
- if !(out = sprockets.find_asset(file, _sprockets))
154
- raise AssetNotFoundError, @args[:file]
144
+ def find_asset(args, sprockets)
145
+ file = args[:file]
146
+ sprockets_ = args[:sprockets] ||= {}
147
+ if !(out = sprockets.find_asset(file, sprockets_))
148
+ raise AssetNotFoundError, args[:file]
155
149
  else
156
150
  out.liquid_tags << self
157
- !args.has_proxies?? out : ProxiedAsset.new( \
158
- out, @args, sprockets, self)
151
+ !args.proxies?? out : ProxiedAsset.new( \
152
+ out, args, sprockets, self)
159
153
  end
160
154
  end
161
155
 
@@ -168,7 +162,7 @@ module Jekyll
168
162
  def capture_and_out_error(site, error)
169
163
  if error.is_a?(Sass::SyntaxError)
170
164
  file = error.sass_filename.gsub(/#{Regexp.escape(site.source)}\//, "")
171
- Jekyll.logger.error(%Q{Error in #{file}:#{error.sass_line} #{error}})
165
+ Jekyll.logger.error(%{Error in #{file}:#{error.sass_line} #{error}})
172
166
  else
173
167
  Jekyll.logger.error \
174
168
  "", error.to_s
@@ -3,14 +3,13 @@ module Jekyll
3
3
  module Liquid
4
4
  class Tag
5
5
  module Defaults
6
- require_relative "defaults/image"
7
-
6
+ autoload :Image, "jekyll/assets/liquid/tag/defaults/image"
8
7
  # TODO: In 3.0 env needs to be enforced, right now it's not
9
8
  # because it's maintain 2.0 API.
10
9
 
11
10
  module_function
12
11
  def set_defaults_for!(tag, args, asset, env = nil)
13
- constants.select { |const| const_get(const).is_for?(tag) }.each do |const|
12
+ constants.select { |const| const_get(const).for?(tag) }.each do |const|
14
13
  const_get(const).new(args, asset, env).set!
15
14
  end
16
15
  end
@@ -8,7 +8,7 @@ module Jekyll
8
8
  class Tag
9
9
  module Defaults
10
10
  class Image
11
- def self.is_for?(tag)
11
+ def self.for?(tag)
12
12
  tag == "img" || tag == "image"
13
13
  end
14
14
 
@@ -16,9 +16,9 @@ module Jekyll
16
16
  # for now it's not enforced to maintain the 2.0 API.
17
17
 
18
18
  def initialize(args, asset, env = nil)
19
+ @args = args
19
20
  @asset = asset
20
- @env = env
21
- @args = args
21
+ @env = env
22
22
  end
23
23
 
24
24
  #
@@ -34,8 +34,8 @@ module Jekyll
34
34
  def set_img_alt
35
35
  if !@env || @env.asset_config["features"]["automatic_img_alt"]
36
36
  @args[:html] ||= {}
37
- if !@args[:html].has_key?("alt")
38
- then @args[:html]["alt"] = @asset.logical_path
37
+ unless @args[:html].key?("alt")
38
+ @args[:html]["alt"] = @asset.logical_path
39
39
  end
40
40
  end
41
41
  end
@@ -2,9 +2,6 @@
2
2
  # Copyright: 2012-2015 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
- require_relative "proxies"
6
- require "forwardable"
7
-
8
5
  module Jekyll
9
6
  module Assets
10
7
  module Liquid
@@ -23,7 +20,7 @@ module Jekyll
23
20
  extend Forwardable
24
21
 
25
22
  def_delegator :@args, :each
26
- def_delegator :@args, :has_key?
23
+ def_delegator :@args, :key?
27
24
  def_delegator :@args, :fetch
28
25
  def_delegator :@args, :store
29
26
  def_delegator :@args, :to_h
@@ -32,7 +29,7 @@ module Jekyll
32
29
 
33
30
  #
34
31
 
35
- Accept = {
32
+ ACCEPT = {
36
33
  "css" => "text/css", "js" => "application/javascript"
37
34
  }
38
35
 
@@ -54,53 +51,38 @@ module Jekyll
54
51
 
55
52
  #
56
53
 
57
- def initialize(args, tag)
58
- @raw_args, @tags = args, tag
59
- @tag = tag
60
- parse_raw
61
- set_accept
62
- end
54
+ def initialize(args, tag, processed: false, raw_args: nil)
55
+ if processed && raw_args
56
+ @args = args
57
+ @raw_args = raw_args
58
+ @tag = tag
63
59
 
64
- # TODO: In 3.0 this needs to be removed and put on the class,
65
- # but because we need to work around the way that Liquid currently
66
- # works it needs to remain.
60
+ elsif processed && !raw_args
61
+ raise ArgumentError, "You must provide raw_args if you pre-process." \
62
+ "Please provide the raw args."
67
63
 
68
- def parse_liquid!(context)
69
- @args = self.class.parse_liquid(@args, context)
64
+ else
65
+ @tag = tag
66
+ @raw_args = args
67
+ parse_raw
68
+ set_accept
69
+ end
70
70
  end
71
71
 
72
72
  #
73
73
 
74
- def self.parse_liquid(hash, context)
75
- hash = hash.to_h if hash.is_a?(self)
76
- return hash unless context.is_a?(::Liquid::Context)
77
- liquid = context.registers[:site].liquid_renderer.file( \
78
- "(jekyll:assets)")
79
-
80
- hash.inject({}) do |hash_, (key, val)|
81
- val = liquid.parse(val).render(context) if val.is_a?(String)
82
- val = parse_liquid(val, context) if val.is_a?(Hash)
83
- hash_.update(
84
- key => val
85
- )
86
- end
74
+ def parse_liquid(context)
75
+ return self unless context.is_a?(Object::Liquid::Context)
76
+ liquid = context.registers[:site].liquid_renderer.file("(jekyll:assets)")
77
+ out = parse_hash_liquid(to_h, liquid, context)
78
+ self.class.new(out, @tag, raw_args: @raw_args, \
79
+ processed: true)
87
80
  end
88
81
 
89
- # TODO: In 3.0 this needs to be put on the class, but because
90
- # we need to work around the way that Liquid currently works in
91
- # 2.0.1 it needs to stay.
92
-
93
82
  def to_html
94
- self.class.to_html(@args)
95
- end
96
-
97
- #
98
-
99
- def self.to_html(hash)
100
- hash.fetch(:html, {}).map do |key, val|
101
- %Q{ #{key}="#{val}"}
102
- end. \
103
- join
83
+ (self[:html] || {}).map do |key, val|
84
+ %{ #{key}="#{val}"}
85
+ end.join
104
86
  end
105
87
 
106
88
  #
@@ -114,22 +96,32 @@ module Jekyll
114
96
 
115
97
  #
116
98
 
117
- def has_proxies?
99
+ def proxies?
118
100
  proxies.any?
119
101
  end
120
102
 
121
103
  #
122
104
 
105
+ private
106
+ def parse_hash_liquid(hash_, liquid, context)
107
+ hash_.each_with_object({}) do |(key, val), hash|
108
+ val = liquid.parse(val).render(context) if val.is_a?(String)
109
+ val = parse_hash_liquid(val, liquid, context) if val.is_a?(Hash)
110
+ hash[key] = val
111
+ end
112
+ end
113
+
114
+ #
115
+
123
116
  private
124
117
  def parse_raw
125
- @args = from_shellwords.each_with_index.inject({}) do |hash, (key, index)|
118
+ @args = from_shellwords.each_with_index.each_with_object({}) do |(key, index), hash|
126
119
  if index == 0 then hash.store(:file, key)
127
120
  elsif key =~ /:/ && (key = key.split(/(?<!\\):/))
128
121
  parse_col hash, key
129
122
 
130
123
  else
131
- (hash[:html] ||= {})[key] = \
132
- true
124
+ (hash[:html] ||= {})[key] = true
133
125
  end
134
126
 
135
127
  hash
@@ -141,17 +133,17 @@ module Jekyll
141
133
  private
142
134
  def parse_col(hash, key)
143
135
  key.push(key.delete_at(-1).gsub(/\\:/, ":"))
144
- if key.size == 3 then as_proxy hash, key
145
- elsif key.size == 2 then as_bool_or_html hash, key
146
- else raise UnescapedColonError
147
- end
136
+ return as_proxy hash, key if key.size == 3
137
+ return as_bool_or_html hash, key if key.size == 2
138
+ raise UnescapedColonError
148
139
  end
149
140
 
150
141
  #
151
142
 
152
143
  private
153
144
  def as_bool_or_html(hash, key)
154
- okey = key; key, sub_key = key
145
+ okey = key
146
+ key, sub_key = key
155
147
  if Proxies.has?(key, @tag, "@#{sub_key}")
156
148
  (hash[key.to_sym] ||= {})[sub_key.to_sym] = true
157
149
  else
@@ -178,11 +170,11 @@ module Jekyll
178
170
 
179
171
  private
180
172
  def set_accept
181
- if Accept.has_key?(@tag) && (!@args.has_key?(:sprockets) || \
182
- !@args[:sprockets].has_key?(:accept))
173
+ if ACCEPT.key?(@tag) && (!@args.key?(:sprockets) || \
174
+ !@args[:sprockets].key?(:accept))
183
175
 
184
176
  (@args[:sprockets] ||= {})[:accept] = \
185
- Accept[@tag]
177
+ ACCEPT[@tag]
186
178
  end
187
179
  end
188
180