# Newbie help : Ruby Processin

**URL:** <https://www.ruby-forum.com/t/newbie-help-ruby-processin/182549>\
**Category:** Ruby\
**Created:** [January 29, 2010, 6:36pm UTC](https://www.ruby-forum.com/t/newbie-help-ruby-processin/182549 "2010-01-29T18:36:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeromeqc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jeromeqc](https://www.ruby-forum.com/u/jeromeqc)\
**Post date:** [January 29, 2010, 6:36pm UTC](https://www.ruby-forum.com/t/newbie-help-ruby-processin/182549/1 "2010-01-29T18:36:24Z")

</div>

## Hello, Looking at the code in the attached file can someone please explain to me in simple terms why in the method

## class Example81 \< Processing::App def setup size screen.width/2, screen.height/2 #Initialize car object @my\_car = Car.new(self) end

## why is ‘self’ is passed as a parameter also why does the initializer for the Car class look like this?

class Car #define a class below the rest of the program

## def initialize(app)

I understand that ‘self’ refers to the current object and objects use  
them to call methods defined within themselves.

Please see the attachement for a better picture of the context of the  
code

Thanks

JD

---

<div class="post-metadata">

**Author:** ![jeromeqc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jeromeqc](https://www.ruby-forum.com/u/jeromeqc)\
**Post date:** [January 29, 2010, 8:25pm UTC](https://www.ruby-forum.com/t/newbie-help-ruby-processin/182549/2 "2010-01-29T20:25:51Z")

</div>

Not sure I understand teh question, but in doing the setup method of  
an Example81 object which inherits from Processing::App, you turn the  
instance variable @my\_car into a Car object by making a new one, with  
the parameter of the new Car as the instance of the Example81 class  
that you are working with.

---

<div class="post-metadata">

**Author:** ![jeromeqc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jeromeqc](https://www.ruby-forum.com/u/jeromeqc)\
**Post date:** [January 31, 2010, 12:33am UTC](https://www.ruby-forum.com/t/newbie-help-ruby-processin/182549/3 "2010-01-31T00:33:15Z")

</div>

Hello Philliam, Thank you for you response. I think that your response  
has given me valuable insight into the code I attached earlier in that I  
now understand that the keywork ‘self’ refers to the object that we are  
currently in. But what is actually passed, a copy, or a reference to an  
instance of Example81?

When we look at @app in the Car class what are .width and .height etc…  
Sureley they would be methods of Example81 that have been inherited from  
the App superclass. Is this a fair assumption to make?

JD
