Path: | lib/more/facets/dependency.rb |
Last Update: | Tue Dec 02 09:46:42 -0500 2008 |
This module is included in Object and allows methods to be given prerequisite dependencies, i.e. methods that must be run before they are.
A dependency will only ever be run once per method call.
include MethodDependency def one; @str << '1'; end def two; @str << '2'; end def show; @str ; end depend :show => [ :x, :y ] show #=> '12'
You can add this functionality to the whole system by simply including it at the toplevel.
Copyright (c) 2006 Thomas Sawyer Ruby License This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.