Hi Darrin, On Jul 2, 2008, at 16:28 , darrin wrote:
> Interesting, first time I've seen this. The alert is actually coming > out of Class.create call. What about this.... > > var MyClass = Class.create({ > initialize: function() { > this.__defineGetter__('test', function() { > alert('inside getter'); > return 'foo'; > }); > > this.__defineSetter__('test', function(new_value) { > alert('inside setter'); > return new_value; > }); > } > }); That works fine indeed. Do you have any idea why that is while the previous snippet did not work? The reason I ask is because I personally dislike the programming style where properties are defined inline the object passed as the parameter to Class.create(), and I prefer to have separate "MyClass.aFunction = function ()" calls. Do you think there is a way to get getters and setters to work in this style? Thanks a lot for your help, Antoine --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---