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.
| # This module defines an alternative to STI where individual types are | |
| # represented by lightweight proxies instead of full models. Each type can have | |
| # its own validations, callbacks, and business logic. In general, client code | |
| # works with the underlying model class directly instead of the type classes, | |
| # but the #as_type method returns a wrapped object that can be used to access | |
| # type-specific logic. | |
| module HasType | |
| INVALID_TYPE_MESSAGE = 'Please choose a valid type' |
| require 'rspec/autorun' | |
| module Stuff | |
| def authenticated_as | |
| puts "1: #{self.inspect}" | |
| context 'when there is stuff' do | |
| puts "2: #{self.inspect}" | |
| yield | |
| end | |
| end |
| str = "foobar"[2..-1] | |
| p str # => "obar" | |
| p str.rindex(/a/) # => 0 | |
| p "obar".rindex(/a/) # => 2 | |
| str = "foobar"[3..-1] | |
| p str # => "bar" | |
| p str.rindex(/a/) # => nil | |
| p "bar".rindex(/a/) # => 1 |
| def self.method_missing(name, *args) | |
| name | |
| end | |
| def function(*param_names, &block) | |
| klass = Class.new { attr_accessor :this, *param_names } | |
| this = TOPLEVEL_BINDING.eval('self') | |
| proc do |*params| | |
| context = klass.new |
| def insert_before(klass, options={}) | |
| instance = new(nil, options) | |
| call_without = "call_without_#{instance.object_id}" | |
| call_with = "call_with_#{instance.object_id}" | |
| klass.class_eval do | |
| define_method call_with do |env| | |
| instance.app = proc { |env| send call_without, env } | |
| instance.call(env) | |
| end |
| # Configs | |
| config windowHintsIgnoreHiddenWindows false | |
| config windowHintsSpread true | |
| config windowHintsShowIcons true | |
| # Aliases | |
| alias showHintsLeftHand hint 0123456789QAZWSXEDCRFVTGB | |
| # Abstract positions | |
| alias full move screenOriginX;screenOriginY screenSizeX;screenSizeY |
| #!/usr/bin/env ruby | |
| # grd: micro Guard. | |
| # | |
| # Watch one or more filename patterns and then run the given command every time | |
| # something changes. | |
| # | |
| # Example: | |
| # grd my_model "rspec spec/models/my_model_spec.rb" |
| # encoding: UTF-8 | |
| # Caches::Base is the basis of a system for caching groups of view fragments. | |
| # Classes that inherit from Caches::Base can manage the rendering of a group of | |
| # related fragments (e.g., a list of papers) without wasting any Postgres | |
| # queries or Memcached fetches. | |
| # | |
| # ### Defining A Subclass | |
| # | |
| # A subclass of Caches::Base represents a fragment of content, like a partial |
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.
| .resizing-text-area__container { | |
| position: relative; | |
| } | |
| .resizing-text-area__input { | |
| height: 100%; | |
| overflow: hidden; | |
| position: absolute; | |
| resize: none; | |
| width: 100%; |