SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    __call()/__get()/__set() (object overloading) in Ruby?

    Hi all.

    I'm looking to find something similar to PHP's Object Overloading methods in Ruby. Can someone point me in the right direction for documentation/examples?

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    __call() is "method_missing" in ruby. Because method call with no arguments looks exactly like property access, method_missing can be also utilized to create virtual properties, like php's __get/set do. "Real" properties are declared with attr* family of methods.

    http://phrogz.net/ProgrammingRuby/ref_c_object.html
    http://phrogz.net/ProgrammingRuby/ref_c_module.html

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I'll look through that documentation.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •