RosettaCodeData/Task/Respond-to-an-unknown-method-call/Fancy/respond-to-an-unknown-method-call.fancy
2023-07-01 13:44:08 -04:00

20 lines
325 B
Text

class CatchThemAll {
def foo {
"foo received" println
}
def bar {
"bar received" println
}
def unknown_message: msg with_params: params {
"message: " ++ msg print
"arguments: " ++ (params join: ", ") println
}
}
a = CatchThemAll new
a foo
a bar
a we_can_do_it
a they_can_too: "eat" and: "walk"