Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Created March 4, 2019 12:46
Show Gist options
  • Save kopylovvlad/cfedc0fb8838229d62b75508b30d7001 to your computer and use it in GitHub Desktop.
Save kopylovvlad/cfedc0fb8838229d62b75508b30d7001 to your computer and use it in GitHub Desktop.
Tags
Hash:
Hash<KeyType, ValueType>
Hash{KeyTypes=>ValueTypes}
how to doc hash in arguments
<%
# @param [Hash] opts the options to create a message with.
# @option opts [String] :subject The subject
# @option opts [String] :from ('nobody') From address
# @option opts [String] :to Recipient email
# @option opts [String] :body ('') The email's body
def send_email(opts = {}) end
%>
Order-Dependent Lists:
(array with 3 various elements)
Array<(String, Fixnum, Hash)>
self:
using for @return self. it is useful for chain
void:
indicates that the type for this tag is explicitly undefined. Mostly used to specify @return tags that do not care about their return value.
Reference tag:
<%
# @param user [String] the username for the operation
# @param host [String] the host that this user is associated with
# @param time [Time] the time that this operation took place
def clean(user, host, time = Time.now) end
# @param (see #clean)
def activate(user, host, time = Time.now) end
%>
@abstract
Marks a class/module/method as abstract with optional implementor information.
<%
# @abstract Subclass and override {#run} to implement
# a custom Threadable class.
class Runnable
def run; raise NotImplementedError end
end
%>
@author
<%
# @author Foo Bar <[email protected]>
class MyClass; end
%>
@deprecated
<%
# @deprecated Use {#bar} instead.
def foo; end
%>
@example
<%
# @example Reverse a String
# "mystring".reverse #=> "gnirtsym"
def reverse; end
%>
@note
<%
# @note This method should only be used in outer space.
def eject; end
%>
@param
<%
# @param url [String] the URL of the page to download
# @param directory [String] the name of the directory to save to
def load_page(url, directory: 'pages') ends
%>
@raise
<%
# @raise [AccountBalanceError] if the account does not have
# sufficient funds to perform the transaction
def withdraw(amount) end
%>
@return
<%
# multy-return
# @return [String] if a single object was returned
# from the database.
# @return [Array<String>] if multiple objects were
# returned.
def find(query) end
%>
@see Name Description
<%
# Synchronizes system time using NTP.
# @see http://ntp.org/documentation.html NTP Documentation
# @see NTPHelperMethods
class NTPUpdater; end
%>
@yield
<%
# For a block {|a,b,c| ... }
# @yield [a, b, c] Gives 3 random numbers to the block
def provide3values(&block) yield(42, 42, 42) end
# @yieldparam [String] name the name that is yielded
def with_name(name) yield(name) end
# @yieldreturn [Fixnum] the number to add 5 to.
def add5_block(&block) 5 + yield end
%>
@!method - to implement abstrack method
<%
# @!method quit(username, message = "Quit")
# Sends a quit message to the server for a +username+.
# @param [String] username the username to quit
# @param [String] message the quit message
quit_message_method
# @!method method1
# @!method method2
create_methods :method1, :method2
%>
@!scope class | instance
<%
# @!scope class
cattr_accessor :subclasses
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment