# Callbacks

**URL:** <https://www.ruby-forum.com/t/callbacks/77494>\
**Category:** Ruby\
**Created:** [November 28, 2006, 12:52pm UTC](https://www.ruby-forum.com/t/callbacks/77494 "2006-11-28T12:52:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav\_bagga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@gaurav\_bagga](https://www.ruby-forum.com/u/gaurav_bagga)\
**Post date:** [November 28, 2006, 12:52pm UTC](https://www.ruby-forum.com/t/callbacks/77494/1 "2006-11-28T12:52:43Z")

</div>

Hi all,

I was just going through mailing list posts i found word “callbacks” .  
was wondering whats a callback.

I’ll appreciate if someone tells me what exactly one means by this.

regards  
gaurav.

---

<div class="post-metadata">

**Author:** ![gaurav\_bagga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@gaurav\_bagga](https://www.ruby-forum.com/u/gaurav_bagga)\
**Post date:** [November 28, 2006, 2:50pm UTC](https://www.ruby-forum.com/t/callbacks/77494/2 "2006-11-28T14:50:59Z")

</div>

On 11/28/06, gaurav bagga [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I was just going through mailing list posts i found word “callbacks” .  
> was wondering whats a callback.

A callback is a callable object passed as an argument to a method.  
This is often needed in event oriented programming. For exemple, when  
building a GUI, whenever you instantiate a button you need to pass to  
the constructor a method to be invoked when the button is clicked.

In Ruby, procs can be used for callbacks. You can find examples of  
this in the Pickaxe Book, in this chapter:  
[http://www.rubycentral.com/book/ext\_tk.html](http://www.rubycentral.com/book/ext_tk.html)

HTH.

Cheers,

Luciano
