Original code copied from: www.mattsears.com/articles/2011/11/27/ruby-blocks-as-dynamic-callbacks Copyright 2011 Matt Sears.
# File lib/deltacloud/core_ext/proc.rb, line 19 def callback(callable, *args) self === Class.new do method_name = callable.to_sym define_method(method_name) { |&block| block.nil? ? true : block.call(*args) } define_method("#{method_name}?") { true } def method_missing(method_name, *args, &block) false; end end.new end
Generated with the Darkfish Rdoc Generator 2.