1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/core_extensions/builder.rb

41 lines
863 B
Ruby
Raw Normal View History

module Middleman::CoreExtensions::Builder
class << self
def registered(app)
app.extend ClassMethods
end
end
module ClassMethods
# Add a block/proc to be run after features have been setup
def after_build(&block)
@run_after_build ||= []
@run_after_build << block
end
def after_build_callbacks
@run_after_build ||= []
@run_after_build
end
2011-08-04 22:52:23 -04:00
def build_reroute(&block)
@build_rerouters ||= []
@build_rerouters << block
end
def reroute_builder(desination, request_path)
@build_rerouters ||= []
result = [desination, request_path]
@build_rerouters.each do |block|
output = block.call(desination, request_path)
if output
result = output
break
end
end
result
end
end
end