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?

···

--
Posted via http://www.ruby-forum.com/.

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.

···

On Dec 23, 2007 8:47 PM, Marc Heiler <shevegen@linuxmail.org> 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?

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.

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:

···

--
Posted via http://www.ruby-forum.com/\.

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

···

On 26.12.2007 04:41, Marc Heiler 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: