Java-Annotations in Ruby?

Hi,

In java one can do annotations in front of method declarations:

http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html

@AjaxCallable public static void deleteImage(int imageId) { … }

I think I have not understood it completely. I am trying to “translate”
this to
ruby. Is there a way to associate these with a method?

On Dec 23, 2007 8:47 PM, Marc H. [email protected] wrote:

I think I have not understood it completely. I am trying to “translate”
this to
ruby. Is there a way to associate these with a method?

I am just reading Matz’s Ruby plans for the
future(http://www.rubyist.net/~matz/slides/rc2005/mgp00026.html).
Annotations are on the wishlist, but I have no idea how far they got.

Annotations are on the wishlist, but I have no idea how far they got.

I am totally “neutral” on this - right now I try to understand if, and
where, these things have any advantage (for ruby. I am sure in Java they
may have some advantages, but I don’t know Java really anyway…)

If one of you has an example for a use case of it please forward with it
:slight_smile:

On 26.12.2007 04:41, Marc H. wrote:

Annotations are on the wishlist, but I have no idea how far they got.

I am totally “neutral” on this - right now I try to understand if, and
where, these things have any advantage (for ruby. I am sure in Java they
may have some advantages, but I don’t know Java really anyway…)

If one of you has an example for a use case of it please forward with it
:slight_smile:

You could search the archives for “method metadata” or “metadata” in
general. There are various approaches how metadata can be “attached” to
methods.

But since you state you do not know Java really, I am wondering what it
is that you are looking for. You say the concept of Java annotations is
not clear to you and yet you expect explanations how to do this in Ruby.
What do you need that for?

Regards

robert

Facets has an annotations system

http://facets.rubyforge.org/rdoc/annotations/

very simple to use:

ann :some_method, :annotation_name => “foovalue”, …

ann :some_method, :annotation_name
=> “foovalue”

T.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs