Last active
August 29, 2015 14:26
-
-
Save fernandes/a6f294797a602559c6e9 to your computer and use it in GitHub Desktop.
YARDoc CheatSheet
This file contains hidden or 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
# This class is an org | |
class Organization < ActiveRecord::Base | |
# @!attribute name | |
# @return [String] The name of the task. | |
# @!attribute description | |
# @return [String] The description of the task. | |
# @!attribute active | |
# @return [Boolean] Marks whether the task is active or not. |
This file contains hidden or 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
class Category < ActiveRecord::Base | |
# includes "UserMixin" | |
# @!parse include FriendlyId | |
include FriendlyId | |
# @return [nil] the title property of the post | |
friendly_id :foo, use: :slugged |
This file contains hidden or 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
# Converts the object into textual markup given a specific format. | |
# | |
# @param format [Symbol] the format type, `:text` or `:html` | |
# @return [String] the object converted into the expected format. | |
def to_format(format = :html) | |
# format the object | |
end | |
class MyWebServer | |
# Handles a request | |
# @param request [Request] the request object | |
# @return [String] the resulting webpage | |
def get(request) "hello" end | |
# (see #get) | |
# @note This method may modify our application state! | |
# @return [String, nil] the contents of our page or nil | |
def post(request) "hello" end | |
end | |
# Method Doc | |
# description | |
# (see #get) to set reference | |
# @note Caution note here | |
# @param format [Symbol] the format type, `:text` or `:html` | |
# @param argname [#to_s] any object that responds to `#to_s` | |
# @param argname [true, false] only true or false | |
# @param list [Array<String, Symbol>] the list of strings and symbols. | |
# @return [String] the object converted into the expected format. | |
# @return [String, nil] the contents of our object or nil | |
# @return the object when do not care about the type | |
# Documenting DSL Methods | |
class Post::Create < Trailblazer::Operation | |
# @return [String] the title property of the post | |
property :title, String | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment