Meta programming with ember?


#1

Are there any kind of meta programming facilities baked into Ember?

I am wondering if there is anything analogous to ruby’s method_missing or respond_to? in rails.

I am trying to hack around inside a class that uses the detect method which is passed a klass parameter. And not quite sure how to tell if it quacks and walks like a particular duck that I am interested in dating.


#2

For method_missing, try implementing unknownProperty(keyName). Make sure to access your properties like obj.get('myKey') instead of obj.myKey since the latter won’t call your unknownProperty function.

For respond_to?, try Ember.canInvoke(obj, methodName).