#529: Using a Proc as a ‘callback function’ -------------------------------------+-------------------------------------- Reporter: eloy.de.enige@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Comment(by eloy.de.enige@…): Actually, the latter examples should probably be more like: {{{ describe "BridgeSupport, where a pointer to a callback function is required" do it "allows the use of a proc as callback" do array = [5, 3, 2, 4, 1] proc = Proc.new { |x, y, _| x <=> y } array.sortUsingFunction(proc, context: nil) array.should == [1, 2, 3, 4, 5] end it "passes the actual objects as arguments instead of the pointers to the arguments" do result = '' proc = Proc.new { |_, __, context| result = context } [1].sortUsingFunction(proc, context: 'foo') result.should == 'foo' end end }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/529#comment:1> MacRuby <http://macruby.org/>