Class Method Definition - Unrecognized Syntax

I am studying the source code contained in session.rb in an effort to
understand how it works. I am encountering various instances of syntax
that I don’t understand. I’m sure Google would be my friend if I knew
what terms to use as search criteria. I’m hoping that I can post a few
of them here for clarification without being overly burdensome.

The first strange syntax that I encountered was what was apparently a
class definition in the Session class: Here’s the syntax:

def Session::create_new_id

In this case the separator between the identity of the class and the
name of the method is a double colon rather than the usual period.
What is the significance of using a double-colon as a separator?

Thanks for any input.

 ... doug

Hi,

Doug J. wrote in post #1071097:

def Session::create_new_id

In this case the separator between the identity of the class and the
name of the method is a double colon rather than the usual period.
What is the significance of using a double-colon as a separator?

There’s none, it’s just a different syntax. Some people prefer the
double colon to specifically mark “class methods”.

There’s none, it’s just a different syntax. Some people prefer the
double colon to specifically mark “class methods”.

That certainly clarifies that issue. Thanks!

 ... doug

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