Don’t use the constructor before initialize is defined

Problem If for some reason, most likely convenience, you want to have a constant containing an instance of an object in your class you have to pay attention to where you define this constant. An example might be that instead of City.new(10, 5) you would want to refer to it as the constant CITY_A.


Don’t use the constructor before initialize is defined #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/don-t-use-the-constructor-before-initialize-is-defined

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles