simplify
This commit is contained in:
parent
0303ed6442
commit
9a3f09986f
|
@ -127,27 +127,6 @@ module Middleman::Base
|
||||||
super(option, value, &nil)
|
super(option, value, &nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
def before_processing(&block)
|
def before_processing(&block)
|
||||||
@before_processes ||= []
|
@before_processes ||= []
|
||||||
@before_processes << block
|
@before_processes << block
|
||||||
|
|
|
@ -16,5 +16,26 @@ module Middleman::CoreExtensions::Builder
|
||||||
@run_after_build ||= []
|
@run_after_build ||= []
|
||||||
@run_after_build
|
@run_after_build
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
||||||
end
|
end
|
Loading…
Reference in a new issue