Nowa wersja RubyMine (3.2) wprowadza lepszy support dla YARD. Sprawa jest generalnie prosta. Piszemy odpowiednio komentarze nad kodem używając składni YARD:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User model used for authentication. | |
# Uses 3.1's has_secure_password | |
# | |
# == Schema information | |
# Table name: users | |
# | |
# id :integer not null, primary key | |
# username :string(150) | |
# email :string(150) | |
# password_digest :string | |
# created_at :datetime | |
# updated_at :datetime | |
# | |
# Meta field (for authentication) | |
# password :string | |
# password_confirmation :string | |
# | |
# @author Krzysztof Zalewski [zlw.zalewski@gmail.com] | |
# | |
class User < ActiveRecord::Base | |
# some code here... | |
# Returns public information about User | |
# | |
# @example Returns profile | |
# User.find(1).get_profile #=> { :id=>1, :username=>"spiderman", (...) } | |
# | |
# @return [Hash] | |
# | |
def get_profile | |
@profile ||= { id: id, username: username, email: email, | |
created_at: created_at, updated_at: updated_at } | |
end | |
end |
Dzięki czemu uzyskujemy lepsze podpowiedzi:
Brak komentarzy:
Prześlij komentarz