[email protected] and [email protected] methods?

Hi all,

Mostly when I do instance.methods.sort in irb, the list contains [email protected]
and [email protected] what are these methods and how used.
I’ll appreciate if someone helps me with this.

Reagrds
Gaurav V Bagga

Sorry I forgot to mention
when I do 1.methods.sort ,Is it something to do with unary operations?

Hi,

On 4/24/07, gaurav bagga [email protected] wrote:

Sorry I forgot to mention
when I do 1.methods.sort ,Is it something to do with unary operations?

1 is an object of type Integer

1.methods is a method in the Object Integer (which outputs an Array of
methods for the integer) and .sort is a method on an Object of Type
Array (which sorts the contents of the Array)

On 4/24/07, [email protected] [email protected] wrote:

Hi all,

Mostly when I do instance.methods.sort in irb, the list contains [email protected]
and [email protected] what are these methods and how used.
I’ll appreciate if someone helps me with this.

From the pickaxe book [email protected] is a unary + operator simply returns the
receivers value and [email protected] returns the negated value for Numeric Objects
(floats / Integers)


Cheers
Gaurav
http://java-n-coffee.blogspot.com
http://rorwebser.blogspot.com
http://eclipsetrip.blogspot.com

अभिजीत

[written in http://www.paahijen.com/scratchpad]

[http://www.paahijen.com]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs