Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.1-beta-2
-
Fix Version/s: 1.1-rc-2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
There is no equivalent of Ruby's respond_to - you have to catch MissingMethodException. E.g.
try {
value = value.toGroovy()
} catch(MissingMethodException) {}
value
instead of
if (value.respondTo("toGroovy")) {
value = value.toGroovy()
}
value
'respondsTo' reads more naturally. I would prefer the method to be called 'respondsTo' over 'respondTo'.