From: Hachenberger Peter Date: 2001-11-13T00:21:52+09:00 Subject: [ruby-talk:24936] Naming conventions Hello, I am trying to create an class, which handles arithmetic operations on triples. I need two constant values for this class looked at the Standard Library "complex.rb" to see how the constant I=(0,1) is realized in it. There I found the following: def Complex(a, b = 0) if a.kind_of?(Complex) and b == 0 a elsif b.kind_of?(Complex) if a.kind_of?(Complex) Complex(a.real-b.image, a.image + b.real) else Complex(a-b.image, b.real) end elsif b == 0 and defined? Complex::Unify a else Complex.new(a, b) end end class Complex < Numeric ... def initialize(a, b = 0) raise "non numeric 1st arg `#{a.inspect}'" if !a.kind_of? Numeric raise "non numeric 2nd arg `#{b.inspect}'" if !b.kind_of? Numeric @real = a @image = b end ... I = Complex(0,1) attr :real attr :image end That's quite an interesting way to solve the problem, but i am curios about the definition of the method Complex. As far as I have read, the naming convention for methods tells us to begin a method name with a lowercase Character. What happens here? Why does ruby know, that Complex is a method call here and not the class name? Peter