YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| 0x847DaF6adA406EF834343EC6365b969ee160472E |
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
| module MemberApi | |
| module ExceptionHelpers | |
| # Usage: | |
| # render_validation_errors(model) unless model.valid? | |
| # | |
| # @param model [ActiveRecord::Base] | |
| # | |
| def render_validation_errors(model, status: :bad_request) | |
| render json: { | |
| full_messages: model.errors.full_messages, |
| # Split long `address_line` line into array of lines | |
| # each with length not greater than `max_length` | |
| def divide_address(address_line, max_length) | |
| assert max_length > 0, "max_length should be a positive number" | |
| address_line = address_line.strip | |
| if address_line.length <= max_length | |
| return [address_line] | |
| else | |
| head = address_line.truncate(max_length, separator: " ", omission: "") | |
| tail = address_line[head.length..-1] |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| FROM bradrydzewski/base | |
| WORKDIR /home/ubuntu | |
| USER ubuntu | |
| ADD rbenv.sh /etc/drone.d/ | |
| RUN cd /home/ubuntu/.rbenv/plugins/ruby-build && \ | |
| git pull | |
| RUN export PATH="/home/ubuntu/.rbenv/bin:$PATH" && \ |
| FROM bradrydzewski/base | |
| WORKDIR /home/ubuntu | |
| USER ubuntu | |
| ADD rbenv.sh /etc/drone.d/ | |
| RUN cd /home/ubuntu/.rbenv/plugins/ruby-build && \ | |
| git pull | |
| RUN export PATH="/home/ubuntu/.rbenv/bin:$PATH" && \ |
| module ParameterizedContentForHelper | |
| # Warning! Content is being rewritten on each next call! | |
| def parameterized_content_for(name, *params, &block) | |
| @parameterized_content_for ||= {} | |
| if block_given? | |
| @parameterized_content_for[name] = block | |
| else | |
| block = @parameterized_content_for[name] | |
| capture *params, &block if block | |
| end |
| #!/bin/bash | |
| if [ -z "$1" ]; then | |
| wdir="." | |
| else | |
| wdir=$1 | |
| fi | |
| for f in $( find . -name '*.erb' ); do | |
| out="${f%.erb}.haml" |
Введение
Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.
http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html
Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.
Ruby