In general, I think the arguments should be Deferred blocks of code,
that is code which is only selectively executed by their context-
controller (fx concat_ext), and where the context controller can
control what context they will be called with, fx:
<%= concat_ext({:ok => true}, lambda{ method_x }, lambda{|context| "y"
if logged_in? && context[:ok] }, my_tags_handler({:color => blue},
lambda{...}, lambda{...}) ...) %>
Then each context-controller can do something like:
def concat_ext(context, args*)
result = ""
procs = *args
procs.each do |proc|
ctx = proc.call(ctx)
# some magic
result << ... <confition?>
end
result
end
Here the outer controller could choose to merge or append its context
with the inner controller as it is called (or something?), to transfer
context.
This design allows for conditional control of output at runtime and
all kinds of other cool things...
For the prawn pdf example it could mean controlling the pdf object
depending on the result/context of each nested tag method call, thus
not only being limited to returning a text string.
Comments, thoughts, ideas?
Kristian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---