Sha256: c5fa2f980bb51ac202ffbfe1370cca0b647a796176296b1c8a83e38359f09a7d
Contents?: true
Size: 627 Bytes
Versions: 6
Compression:
Stored size: 627 Bytes
Contents
#!./bin/nake # Default value returned from Task["not_existing_task"] don't have to be even a task, # it just have to respond to #call, so you can use Hash#default_proc=(proc) as well # Just make sure you are wrap the callable object in lambda, because the callable # object has to be returned as a result from the finding on the hash, but the # default proc is what is actually called if nothing is found. # You might i. e. customize error message or you might detect desired task in runtime. Task.tasks.default_proc = lambda do |tasks, name| lambda { |*args| abort("Task #{name} executed with args: #{args.inspect}") } end
Version data entries
6 entries across 6 versions & 1 rubygems