Editing Topic: RCR249 Project: RCR | RCRchive home

RCR 249: Object#self

submitted by itsme213 on Sat Apr 24 2004 02:28:16 PM -0700

Status: pending


Abstract

A pre-defined method on Object
class Object
  def self *args
     self
  end
end

Problem

Transforms on objects are often done by methods like to_s, to_i, intern, etc. A default transform should be available that 'does nothing'. This eliminates the need for sentinels such as 'nil' when you want to uniformly define some such mappings, but some things do not need to be mapped. e.g. mapping types from domain objects to/from UI widgets.

Proposal

As above

Analysis

The only question I see is whether we can name such a method 'self', or if we need some other name.

Implementation

As above


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog