You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you'd need something to evaluate the hooks.rb with. You could define a new class or module containing the after and before methods (and any other) or you could simply expose them at Glyph-level. At any rate, you'd have to run an instance_eval or class_eval when loading the files. The methods would be fairly simple:
def after(command, &block)
# Code to store block in Glyph::HOOKS[:project][command][:after]
end
...then, all you'd have to do is to call hooks from wherever you like inside each command, for example like this:
Implementation Hints
You'd have to store Proc objects somewhere, i.e. a Glyph::HOOKS hash, maybe something like this:
Then you'd need something to evaluate the hooks.rb with. You could define a new class or module containing the after and before methods (and any other) or you could simply expose them at Glyph-level. At any rate, you'd have to run an instance_eval or class_eval when loading the files. The methods would be fairly simple:
...then, all you'd have to do is to call hooks from wherever you like inside each command, for example like this:
This is just a possible quick-and-dirty implementation. Obviously there are much better ways to do this.
The text was updated successfully, but these errors were encountered: