Hi,
Then you'll probably enjoy this thread:
http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/db7fd3d685bb41c2#
--
T.J. Crowder
tj / crowder software / com
On May 22, 3:09 pm, Frederick Polgardy <[EMAIL PROTECTED]> wrote:
> I might get in trouble with the with-Nazis for this, but I came up
> with what I think is a cool class definition pattern for Prototype,
> that gives you visibility over Class attributes, similar to what you
> would experience in more static languages:
>
> var Foo = Class.create();
> Object.extend(Foo, {
> A_CLASS_CONSTANT: 42,
> a_class_method: function() {
> }});
>
> with (Foo) addMethods({
> an_instance_method: function() {
> alert(A_CLASS_CONSTANT);
> a_class_method();
> }
>
> });
>
> Apart from the usual 'with' pitfalls, it's pretty clean.
>
> Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---