Skip to content

Instantly share code, notes, and snippets.

@fernandes
Last active August 29, 2015 14:26
Show Gist options
  • Save fernandes/a6f294797a602559c6e9 to your computer and use it in GitHub Desktop.
Save fernandes/a6f294797a602559c6e9 to your computer and use it in GitHub Desktop.
YARDoc CheatSheet
# 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.
class Category < ActiveRecord::Base
# includes "UserMixin"
# @!parse include FriendlyId
include FriendlyId
# @return [nil] the title property of the post
friendly_id :foo, use: :slugged
# 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