How to simulate Java-like annotations in ruby?
(Well, I have the answer, generalizing
http://bens.me.uk/2009/java-style-annotations-in-ruby)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is adapted from a piece of code I wrote in an answer to another question a couple of weeks ago, although it is of course hardly original. This is a well-known Ruby idiom, after all, which has been in use for many years, at least since
rakes‘sdescmethod.Here’s a small example:
And of course no Ruby code would be complete without a testsuite: