I'm unhappy with nodelet class interface as it stands now, I'm thinking of ways to fix it. Here's some ideas, I'd like some feedback.
As it stands now, you declare your nodelet class, and can optionally include a #configure method, which gets called on initialization. This interacts awkwardly when combined with Node#nodelet do; #block stuff; end. Proposed new interface:
class MyNodelet < DripDrop::Node::Nodelet
def pre_action
end
def action
end
def post_action
end
end
given this new system, when you call say nodelet :mynodelet, MyNLetClass {|nlet| ... }
what would happen is:
The nodelet gets initialized
Your block gets run in the context of the nodelet
pre_action gets called
action gets called.
post_action gets called.
All of the pre/post/action methods would be optional.
This all dovetails with the new Node#run_list setting quite well, as having a standard #action method means you don't manually have to kick-off your nodelets later.
I'm unhappy with nodelet class interface as it stands now, I'm thinking of ways to fix it. Here's some ideas, I'd like some feedback.
As it stands now, you declare your nodelet class, and can optionally include a #configure method, which gets called on initialization. This interacts awkwardly when combined with Node#nodelet do; #block stuff; end. Proposed new interface:
class MyNodelet < DripDrop::Node::Nodelet def pre_action end def action end def post_action end end
given this new system, when you call say nodelet :mynodelet, MyNLetClass {|nlet| ... }
what would happen is:
All of the pre/post/action methods would be optional.
This all dovetails with the new Node#run_list setting quite well, as having a standard #action method means you don't manually have to kick-off your nodelets later.