Y
yeah
In Ruby I can define a special method_missing method in my class like
so:
class MyClass
def do_something
"did it"
end
def method_missing
"could not do that, let's do something instead: " + do_something
end
end
Consequently the following statements would have the indicated results:
obj = new MyClass
obj.do_something #--> "did it"
obj.do_something_else #--> "could not do that, let's do something
instead: did it"
Is such a thing possible in JavaScript? Note: I do not know at design
time which method could possible be called on my objects...
so:
class MyClass
def do_something
"did it"
end
def method_missing
"could not do that, let's do something instead: " + do_something
end
end
Consequently the following statements would have the indicated results:
obj = new MyClass
obj.do_something #--> "did it"
obj.do_something_else #--> "could not do that, let's do something
instead: did it"
Is such a thing possible in JavaScript? Note: I do not know at design
time which method could possible be called on my objects...