Новое в рейлс: аннотации кода

Илья • 27 февраля 2007 г.

Новенькая фишка в edge rails. Теперь в коде можно расставлять маленькие заметочки для себя, а потом удобно вывести их все на экран, используя rake.

Например в коде у нас вот что:
class Friendship < ActiveRecord::Base

  # TODO: Ability to make friends with your eyes closed.
  def make_friends
    #code here
  end

  # FIXME: Right now if your friend is Britney you just can't lose her...
  def lose_friends
    #code here
  end

  # OPTIMIZE: Contact Hannibal to optimize this method
  def eat_friend
    #code here
  end

end

А потом запускаем rake notes и получаем список всех заметок со всего приложения:

$ rake notes
app/models/friendship.rb:
 * [3] [TODO] Ability to make friends with your eyes closed.
 * [8] [FIXME] Right now if your friend is Britney you just can't lose her...
 * [13] [OPTIMIZE] Contact Hannibal to optimize this method

2 комментария:

  1. shaliko:

    Спасибо за информацию!

  2. Van:

    Приятная фича

Извините, но комментарии для этой статьи уже закрыты.