Module: Taskinator::Definition
- Defined in:
- lib/taskinator/definition.rb,
lib/taskinator/definition/builder.rb
Defined Under Namespace
Classes: Builder, UndefinedProcessError
Instance Method Summary collapse
-
#create_process(*args) ⇒ Object
creates an instance of the process NOTE: the supplied @args are serialized and ultimately passed to each method of the defined process.
-
#define_process(*arg_list, &block) ⇒ Object
defines a process.
Instance Method Details
#create_process(*args) ⇒ Object
creates an instance of the process NOTE: the supplied @args are serialized and ultimately passed to each method of the defined process
21 22 23 24 |
# File 'lib/taskinator/definition.rb', line 21 def create_process(*args) raise UndefinedProcessError unless respond_to?(:_create_process_) _create_process_(*args) end |
#define_process(*arg_list, &block) ⇒ Object
defines a process
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/taskinator/definition.rb', line 6 def define_process(*arg_list, &block) define_singleton_method :_create_process_ do |*args| # TODO: better validation of arguments raise ArgumentError, "wrong number of arguments (#{args.length} for #{arg_list.length})" if args.length < arg_list.length process = Process.define_sequential_process_for(self) Builder.new(process, self, *args).instance_eval(&block) process.save process end end |