What does '::' actually mean ?

HI everyone,

I'm just getting my head around Ruby/RoR syntax & wondered exactly what the colon/colon means in the example below ( and similar contexts ) ? ( I see that the < is inheritance )

I've read it is something to do with Class Methods ?

I also assume it is Ruby ? not RoR

e.g. class ApplicationController < ActionController::Base

TIA - Dave Porter

I'm a newbie to ruby, and this is really a ruby question, rather than a rails question, but, yes, it signifies class methods.

An instance method will give varying results -- unique to each instance (object). The simplest example of an instance method (coming from Java) would be the getter/setter methods.

foo.set_var = 5 foo.print_var #will print "5"

bar.set_var = 10 bar.print_var #will print "10"

Here, the same method will give different results. For object foo, the result is 5, for object bar the result is 10.

Conversely, consider:

myMath.sin(x)

Do you want the above to give different results for different instances?
I would hope not!

-Thufir

I have a screencast for this “Modules in Ruby”. Check it out.

Thanks to everyone for their help.... Merry Xmas to all. Dave