syntax:
# active record style
before_save <pattern> do |card|
#...
end
OR
before_save <pattern> do
# this code executed in context of card object
end
OR
# a more explicit syntax with options for multiple hooks, multiple patterns, and a priority setting
on :hook=>[:name_change, :type_change], :pattern=>[ <pattern1>, <pattern2> ], :priority=>0 do
# ...
end
OR
? ...
hook list:
access needs:
collisions
generally I expect these hooks to be additive. If that's the case I don't know if we need to be able to "overwrite" hook implementations from other modules, and if so, how.
notes:
I really like this stuff, but also would like to connect this to what I was developing about the DSL question. I like the more specific syntaxes and think modules should be able to add these. The most basic Card deployment would have no security (i.e. a local resource deploy, etc.) for example so you any hooks for that would be optional. I think "everything is optional" is a good goal. For example, you would only have before/after_multi_update when modules doing multi-update are loaded. I might have an XML only deploy without this, but no problem if you register for a hook that is never called.
I think that you could make each sub-action from layout through authorization and rendering for action could be a hook, including the ones you list. In other words I want to define everything in the DSL in terms of hooks (maybe), some parts that define hooks, and others that define the order in which the hooks will be called to process the next hook.
--Gerry Gleason.....Fri Oct 16 06:33:57 -0700 2009