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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sun, 23 Dec 2007 01:22:17 -0800, Davo wrote:> I''ve read it is something to do with Class Methods ?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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Its a ruby thing. Maybe this will help, the abridged source to the example you gave module ActionController class Base #...bunch of code... end end And then that is referenced as ActionController::Base Usually I imagine it as a namespace thing. The module is ActionController. The specific class is Base. There is actually more to it but thats a start. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have a screencast for this "Modules in Ruby". Check it out. On Dec 23, 2007 1:22 AM, Davo <Dave.SouthPerth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 ) >-- http://www.rubyplus.org/ Free Ruby Screencasts --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks to everyone for their help.... Merry Xmas to all. Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---