Re: Extending existing methods of base classes and Loose Methods.



Hi Marc,

Marc Michael escribió:
On 25 Feb., 16:01, cenopel...@xxxxxxxxx wrote:

I would use sublcass, or any other way, it would be interested to here
further toths on this subject.

A subclass wouldn't be fine IMO. My application is a simple URL-
Encoder/-Decoder. I want to encode a string. So I simply added a
method urlEncoder to the class String and now I am able to do the
following:

'Hello#World' urlEncode

Just FYI, the Swazoo package, already defines such functionality on String, trough httpEncoded/httpDecoded methods.

Best regards,

--
Esteban.




.



Relevant Pages

  • Re: Extending existing methods of base classes and Loose Methods.
    ... Encoder/-Decoder. ... I want to encode a string. ... method urlEncoder to the class String and now I am able to do the ... which characters should be encoded, he created a set which determines ...
    (comp.lang.smalltalk.dolphin)
  • Re: What it the type of the Class without modifier
    ... but the class String is not of type String. ... >My main point is that data types can be built-in types (int, char, ... "User-defined types" also might risk confusion between classes that ...
    (comp.lang.java.help)
  • Re: AOP beginner
    ... Ruby makes "Monkey Patching" very easy. ... standard library class String, and I need to convert strings into YPath ... libraries that abuse Monkey Patching often conflict with other ...
    (comp.object)
  • Re: AOP beginner
    ... Ruby makes "Monkey Patching" very easy. ... standard library class String, and I need to convert strings into YPath ... libraries that abuse Monkey Patching often conflict with other ...
    (comp.object)
  • Re: Scope
    ...   def to_b ... This opens up the system class String (or::String if you prefer to ... explicitly specify the outer scope) and adds an instance method ...
    (comp.lang.ruby)