Nicolás Sanguinetti a écrit :
> But what about declaring a toTemplateReplacements in the object? (the
> following is untested)
Yes, that's the current way to go.
> MyClass = Class.create({
> initialize: function(a, b, c) { this._a = a; this._b = b; this._c = c },
> first: function() { return this._a },
> second: function() { return this._b },
> third: function() { return this._c },
>
> toTemplateReplacements: function() {
> return { first: this.first(), second: this.second(), third: this.third() }
> }
> });
>
> var obj = new MyClass(1, 2, 3);
> "Hey, I'm #{first}, i'm #{second} and I'm #{third}".interpolate(obj);
> //=> "Hey, I'm 1, I'm 2 and I'm 3"
>
> That's supposedly the use of toTemplateReplacements :)
Absolutely. I can understand, however, people wanting to squeeze more
power out of evaluate/interpolate…
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---