Module: Middleman::Assets
- Defined in:
- lib/middleman/assets.rb
Constant Summary collapse
- @@asset_handler_map =
[]
- @@asset_handler_stack =
[]
Class Method Summary collapse
- .before(position, *args) ⇒ Object
- .get_url(path, prefix = "", request = nil) ⇒ Object
- .register(handler_name, &block) ⇒ Object
Class Method Details
.before(position, *args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/middleman/assets.rb', line 17 def self.before(position, *args) current_index = @@asset_handler_map.index(position) return nil unless current_index previous = current_index - 1 if (previous >= 0) && (previous < @@asset_handler_map.length) @@asset_handler_stack[previous].call(*args) else nil end end |
.get_url(path, prefix = "", request = nil) ⇒ Object
13 14 15 |
# File 'lib/middleman/assets.rb', line 13 def self.get_url(path, prefix="", request=nil) @@asset_handler_stack.last.call(path, prefix, request) end |
.register(handler_name, &block) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/middleman/assets.rb', line 6 def self.register(handler_name, &block) if block_given? @@asset_handler_stack << block @@asset_handler_map << handler_name end end |