Class: Proc

Inherits:
Object
  • Object
show all
Defined in:
lib/jcr/evaluate_rules.rb

Overview

Adapted from Matt Sears

Instance Method Summary collapse

Instance Method Details

#jcr_callback(callable, *args) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/jcr/evaluate_rules.rb', line 36

def jcr_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