タグ

annotationに関するysano2005のブックマーク (2)

  • Annotations in Ruby

    A couple of days ago I wished there was a way to use annotations in Ruby. I'm writing a Ruby on Rails application that renders a lot of objects in HTML. Many of these objects are "editable" via the web interface, and in order to make it easier for the user, I wanted the web interface to have both an explanatory text and a HTML tooltip for each object's field. Because I like simple things I also li

  • メモ: アノテーション(メタデータ)

    Java(Tiger)、C#、ActionScripot3などで採用されるアノテーション(メタデータ)について、Rubyにも欲しいので実現方法をちょっと考えてみる。 アノテーションの定義方法はこんなものだろうか… コメントをパースして、@module/@classなどのキーワードをベースにパースする。 @Foo = Class.new{} のように'@'と大文字で始まるものをアノテーションとする。 Rubyを拡張して@module/@classなどのキーワードを加える。 次に、アノテーションの利用方法はこんな感じ… @Foo @Foo("foo") または @Foo["foo"] @Foo(:key=>"foo") @Foo[ @SubFoo(:key=>"foo1"), @SubFoo(:key=>"foo2"), ... ] 来は、プログラムに影響を与えない方法がいいが、Rubyで実

    メモ: アノテーション(メタデータ)
  • 1