Why a new method is not needed to create Rational in ruby

Possible duplicate:
Ruby syntax question: Rational (a, b) and Rational.new! (a, b)

I am in the process of reading a ruby ​​pickaxe, and I am confused by the syntax of creating rational numbers.

Rational(3,4) * Rational(1,2)

produces

=> 3/8

Why is the method newnot needed for Rational(I also noticed, for example, I can create a string without a new method)?

+5
source share
2 answers

-, Ruby new. new - , ( Class), . - Rational(3,4), Rational Object ( Kernel), . - . : fooobar.com/questions/1118051/...

+6

, , . idiom Ruby.

+3

All Articles