2013-04-13 13:45:21 -04:00
|
|
|
snippet enc
|
|
|
|
# encoding: utf-8
|
2016-06-11 09:56:50 -04:00
|
|
|
snippet frozen
|
|
|
|
# frozen_string_literal: true
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet #!
|
|
|
|
#!/usr/bin/env ruby
|
|
|
|
# New Block
|
|
|
|
snippet =b
|
|
|
|
=begin rdoc
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
=end
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet prot
|
|
|
|
protected
|
|
|
|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet priv
|
|
|
|
private
|
|
|
|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet y
|
2013-11-16 14:45:48 -05:00
|
|
|
:yields: ${0:arguments}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet rb
|
|
|
|
#!/usr/bin/env ruby -wKU
|
|
|
|
snippet beg
|
|
|
|
begin
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2021-05-05 04:25:00 -04:00
|
|
|
rescue ${1:StandardError} => ${2:e}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet req require
|
2014-08-03 18:02:51 -04:00
|
|
|
require '${1}'
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet reqr
|
2014-08-03 18:02:51 -04:00
|
|
|
require_relative '${1}'
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet #
|
|
|
|
# =>
|
|
|
|
snippet case
|
|
|
|
case ${1:object}
|
2022-09-20 04:08:31 -04:00
|
|
|
when $2
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet when
|
2022-09-20 04:08:31 -04:00
|
|
|
when $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet def
|
|
|
|
def ${1:method_name}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2023-04-01 16:48:04 -04:00
|
|
|
snippet defm
|
|
|
|
def ${1:method}
|
|
|
|
@$1 ||= ${0}
|
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet deft
|
|
|
|
def test_${1:case_name}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
|
|
|
end
|
|
|
|
snippet descendants
|
|
|
|
class Class
|
|
|
|
def descendants
|
2014-08-03 18:02:51 -04:00
|
|
|
ObjectSpace.each_object(::Class).select { |klass| klass < self }
|
2013-11-16 14:45:48 -05:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet if
|
2022-09-20 04:08:31 -04:00
|
|
|
if $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet ife
|
2022-09-20 04:08:31 -04:00
|
|
|
if $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${2:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
else
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet eif
|
2022-09-20 04:08:31 -04:00
|
|
|
elsif $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2015-01-18 07:58:28 -05:00
|
|
|
snippet ifee
|
2022-09-20 04:08:31 -04:00
|
|
|
if $1
|
2015-01-18 07:58:28 -05:00
|
|
|
$2
|
2022-09-20 04:08:31 -04:00
|
|
|
elsif $3
|
2015-01-18 07:58:28 -05:00
|
|
|
$4
|
|
|
|
else
|
|
|
|
$0
|
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet unless
|
2022-09-20 04:08:31 -04:00
|
|
|
unless $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2015-01-18 07:58:28 -05:00
|
|
|
snippet unlesse
|
2022-09-20 04:08:31 -04:00
|
|
|
unless $1
|
2015-01-18 07:58:28 -05:00
|
|
|
$2
|
|
|
|
else
|
|
|
|
$0
|
|
|
|
end
|
|
|
|
snippet unlesee
|
2022-09-20 04:08:31 -04:00
|
|
|
unless $1
|
2015-01-18 07:58:28 -05:00
|
|
|
$2
|
2022-09-20 04:08:31 -04:00
|
|
|
elsif $3
|
2015-01-18 07:58:28 -05:00
|
|
|
$4
|
|
|
|
else
|
|
|
|
$0
|
|
|
|
end
|
2013-11-16 14:45:48 -05:00
|
|
|
snippet wh
|
2022-09-20 04:08:31 -04:00
|
|
|
while $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet for
|
|
|
|
for ${1:e} in ${2:c}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet until
|
2022-09-20 04:08:31 -04:00
|
|
|
until $1
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet cla class .. end
|
2013-07-17 19:06:05 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2015-12-08 08:20:04 -05:00
|
|
|
snippet clai class .. initialize .. end
|
2013-07-17 19:06:05 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
2012-08-16 23:41:25 -04:00
|
|
|
def initialize(${2:args})
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
end
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet cla< class .. < ParentClass .. initialize .. end
|
2013-07-17 19:06:05 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
|
2012-08-16 23:41:25 -04:00
|
|
|
def initialize(${3:args})
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
end
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet blankslate class BlankSlate .. initialize .. end
|
2013-11-16 14:45:48 -05:00
|
|
|
class ${0:BlankSlate}
|
2012-08-16 23:41:25 -04:00
|
|
|
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
|
|
|
|
end
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet claself class << self .. end
|
2012-08-16 23:41:25 -04:00
|
|
|
class << ${1:self}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# class .. < DelegateClass .. initialize .. end
|
|
|
|
snippet cla-
|
2013-07-17 19:06:05 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
|
2012-08-16 23:41:25 -04:00
|
|
|
def initialize(${3:args})
|
|
|
|
super(${4:del_obj})
|
|
|
|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
snippet mod module .. end
|
2013-07-17 19:06:05 -04:00
|
|
|
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# attr_reader
|
|
|
|
snippet r
|
2013-11-16 14:45:48 -05:00
|
|
|
attr_reader :${0:attr_names}
|
2012-08-16 23:41:25 -04:00
|
|
|
# attr_writer
|
|
|
|
snippet w
|
2013-11-16 14:45:48 -05:00
|
|
|
attr_writer :${0:attr_names}
|
2012-08-16 23:41:25 -04:00
|
|
|
# attr_accessor
|
|
|
|
snippet rw
|
2013-11-16 14:45:48 -05:00
|
|
|
attr_accessor :${0:attr_names}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet atp
|
2013-11-16 14:45:48 -05:00
|
|
|
attr_protected :${0:attr_names}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ata
|
2013-11-16 14:45:48 -05:00
|
|
|
attr_accessible :${0:attr_names}
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet ana
|
2013-11-16 14:45:48 -05:00
|
|
|
accepts_nested_attributes_for :${0:association}
|
2013-07-17 19:06:05 -04:00
|
|
|
# ivc == instance variable cache
|
|
|
|
snippet ivc
|
2013-12-28 13:23:13 -05:00
|
|
|
@${1:variable_name} ||= ${0:cached_value}
|
2012-08-16 23:41:25 -04:00
|
|
|
# include Enumerable
|
|
|
|
snippet Enum
|
|
|
|
include Enumerable
|
|
|
|
|
|
|
|
def each(&block)
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# include Comparable
|
|
|
|
snippet Comp
|
|
|
|
include Comparable
|
|
|
|
|
|
|
|
def <=>(other)
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# extend Forwardable
|
|
|
|
snippet Forw-
|
|
|
|
extend Forwardable
|
|
|
|
# def self
|
|
|
|
snippet defs
|
|
|
|
def self.${1:class_method_name}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-07-17 19:06:05 -04:00
|
|
|
# def initialize
|
|
|
|
snippet definit
|
|
|
|
def initialize(${1:args})
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2013-07-17 19:06:05 -04:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
# def method_missing
|
|
|
|
snippet defmm
|
|
|
|
def method_missing(meth, *args, &blk)
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet defd
|
2013-11-16 14:45:48 -05:00
|
|
|
def_delegator :${1:@del_obj}, :${2:del_meth}, :${0:new_name}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet defds
|
2013-11-16 14:45:48 -05:00
|
|
|
def_delegators :${1:@del_obj}, :${0:del_methods}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet am
|
2013-11-16 14:45:48 -05:00
|
|
|
alias_method :${1:new_name}, :${0:old_name}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet app
|
2022-10-15 15:05:32 -04:00
|
|
|
if __FILE__ == \$PROGRAM_NAME
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# usage_if()
|
|
|
|
snippet usai
|
|
|
|
if ARGV.${1}
|
2022-10-15 15:05:32 -04:00
|
|
|
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# usage_unless()
|
|
|
|
snippet usau
|
|
|
|
unless ARGV.${1}
|
2022-10-15 15:05:32 -04:00
|
|
|
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet array
|
2013-11-16 14:45:48 -05:00
|
|
|
Array.new(${1:10}) { |${2:i}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet hash
|
2013-11-16 14:45:48 -05:00
|
|
|
Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet file File.foreach() { |line| .. }
|
2014-08-03 18:02:51 -04:00
|
|
|
File.foreach(${1:'path/to/file'}) { |${2:line}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet file File.read()
|
2014-08-03 18:02:51 -04:00
|
|
|
File.read(${1:'path/to/file'})
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet Dir Dir.global() { |file| .. }
|
2014-08-03 18:02:51 -04:00
|
|
|
Dir.glob(${1:'dir/glob/*'}) { |${2:file}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet Dir Dir[".."]
|
2014-08-03 18:02:51 -04:00
|
|
|
Dir[${1:'glob/**/*.rb'}]
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet dir
|
|
|
|
Filename.dirname(__FILE__)
|
|
|
|
snippet deli
|
2013-11-16 14:45:48 -05:00
|
|
|
delete_if { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet fil
|
2013-11-16 14:45:48 -05:00
|
|
|
fill(${1:range}) { |${2:i}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
# flatten_once()
|
|
|
|
snippet flao
|
2014-08-03 18:02:51 -04:00
|
|
|
reduce(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2) }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet zip
|
2013-11-16 14:45:48 -05:00
|
|
|
zip(${1:enums}) { |${2:row}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
# downto(0) { |n| .. }
|
|
|
|
snippet dow
|
2013-11-16 14:45:48 -05:00
|
|
|
downto(${1:0}) { |${2:n}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ste
|
2013-11-16 14:45:48 -05:00
|
|
|
step(${1:2}) { |${2:n}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet tim
|
2013-11-16 14:45:48 -05:00
|
|
|
times { |${1:n}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet upt
|
2013-11-16 14:45:48 -05:00
|
|
|
upto(${1:1.0/0.0}) { |${2:n}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet loo
|
2013-11-16 14:45:48 -05:00
|
|
|
loop { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ea
|
2013-11-16 14:45:48 -05:00
|
|
|
each { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ead
|
|
|
|
each do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eab
|
2013-11-16 14:45:48 -05:00
|
|
|
each_byte { |${1:byte}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eac- each_char { |chr| .. }
|
2013-11-16 14:45:48 -05:00
|
|
|
each_char { |${1:chr}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eac- each_cons(..) { |group| .. }
|
2013-11-16 14:45:48 -05:00
|
|
|
each_cons(${1:2}) { |${2:group}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eai
|
2013-11-16 14:45:48 -05:00
|
|
|
each_index { |${1:i}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eaid
|
|
|
|
each_index do |${1:i}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eak
|
2013-11-16 14:45:48 -05:00
|
|
|
each_key { |${1:key}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eakd
|
|
|
|
each_key do |${1:key}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eal
|
2013-11-16 14:45:48 -05:00
|
|
|
each_line { |${1:line}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eald
|
|
|
|
each_line do |${1:line}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eap
|
2013-11-16 14:45:48 -05:00
|
|
|
each_pair { |${1:name}, ${2:val}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eapd
|
|
|
|
each_pair do |${1:name}, ${2:val}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eas-
|
2013-11-16 14:45:48 -05:00
|
|
|
each_slice(${1:2}) { |${2:group}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet easd-
|
|
|
|
each_slice(${1:2}) do |${2:group}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eav
|
2013-11-16 14:45:48 -05:00
|
|
|
each_value { |${1:val}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eavd
|
|
|
|
each_value do |${1:val}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet eawi
|
2013-11-16 14:45:48 -05:00
|
|
|
each_with_index { |${1:e}, ${2:i}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet eawid
|
2013-04-13 13:45:21 -04:00
|
|
|
each_with_index do |${1:e}, ${2:i}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet eawo
|
2013-11-16 14:45:48 -05:00
|
|
|
each_with_object(${1:init}) { |${2:e}, ${3:var}| ${0} }
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet eawod
|
|
|
|
each_with_object(${1:init}) do |${2:e}, ${3:var}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2013-04-13 13:45:21 -04:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet reve
|
2013-11-16 14:45:48 -05:00
|
|
|
reverse_each { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet reved
|
|
|
|
reverse_each do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet inj
|
2013-11-16 14:45:48 -05:00
|
|
|
inject(${1:init}) { |${2:mem}, ${3:var}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet injd
|
|
|
|
inject(${1:init}) do |${2:mem}, ${3:var}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet red
|
2013-11-16 14:45:48 -05:00
|
|
|
reduce(${1:init}) { |${2:mem}, ${3:var}| ${0} }
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet redd
|
|
|
|
reduce(${1:init}) do |${2:mem}, ${3:var}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2013-07-17 19:06:05 -04:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet map
|
2013-11-16 14:45:48 -05:00
|
|
|
map { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet mapd
|
|
|
|
map do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet mapwi-
|
2013-11-16 14:45:48 -05:00
|
|
|
enum_with_index.map { |${1:e}, ${2:i}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet sor
|
2013-11-16 14:45:48 -05:00
|
|
|
sort { |a, b| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet sorb
|
2013-11-16 14:45:48 -05:00
|
|
|
sort_by { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ran
|
|
|
|
sort_by { rand }
|
|
|
|
snippet all
|
2013-11-16 14:45:48 -05:00
|
|
|
all? { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet any
|
2013-11-16 14:45:48 -05:00
|
|
|
any? { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet cl
|
2013-11-16 14:45:48 -05:00
|
|
|
classify { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet col
|
2013-11-16 14:45:48 -05:00
|
|
|
collect { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet cold
|
|
|
|
collect do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet det
|
2013-11-16 14:45:48 -05:00
|
|
|
detect { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet detd
|
|
|
|
detect do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet fet
|
2013-11-16 14:45:48 -05:00
|
|
|
fetch(${1:name}) { |${2:key}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet fin
|
2013-11-16 14:45:48 -05:00
|
|
|
find { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet find
|
|
|
|
find do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet fina
|
2013-11-16 14:45:48 -05:00
|
|
|
find_all { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet finad
|
|
|
|
find_all do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet gre
|
2013-11-16 14:45:48 -05:00
|
|
|
grep(${1:/pattern/}) { |${2:match}| ${0} }
|
2023-04-01 16:48:04 -04:00
|
|
|
snippet grepv
|
|
|
|
select { |${1:line}| $1 !~ ${2:/pattern/} }${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet sub
|
2013-11-16 14:45:48 -05:00
|
|
|
${1:g}sub(${2:/pattern/}) { |${3:match}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet sca
|
2013-11-16 14:45:48 -05:00
|
|
|
scan(${1:/pattern/}) { |${2:match}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet scad
|
|
|
|
scan(${1:/pattern/}) do |${2:match}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet max
|
2013-11-16 14:45:48 -05:00
|
|
|
max { |a, b| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet min
|
2013-11-16 14:45:48 -05:00
|
|
|
min { |a, b| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet par
|
2013-11-16 14:45:48 -05:00
|
|
|
partition { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet pard
|
|
|
|
partition do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet rej
|
2013-11-16 14:45:48 -05:00
|
|
|
reject { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet rejd
|
|
|
|
reject do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet sel
|
2013-11-16 14:45:48 -05:00
|
|
|
select { |${1:e}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet seld
|
|
|
|
select do |${1:e}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet lam
|
2013-11-16 14:45:48 -05:00
|
|
|
lambda { |${1:args}| ${0} }
|
2014-08-03 18:02:51 -04:00
|
|
|
snippet ->
|
|
|
|
-> { ${0} }
|
|
|
|
snippet ->a
|
|
|
|
->(${1:args}) { ${0} }
|
2013-07-17 19:06:05 -04:00
|
|
|
# I'm pretty sure that ruby users expect do to expand to do .. end
|
|
|
|
snippet do
|
2012-08-16 23:41:25 -04:00
|
|
|
do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-07-17 19:06:05 -04:00
|
|
|
# this is for one or more variables. typing a ", " is that cheap that it may
|
|
|
|
# not be worth adding another snippet. should 0/1 placeholders change order?
|
|
|
|
# its a good idea to think about the var name, so use it first
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet dov
|
2013-11-16 14:45:48 -05:00
|
|
|
do |${1:v}|
|
|
|
|
${2}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet :
|
2014-08-03 18:02:51 -04:00
|
|
|
${1:key}: ${2:'value'}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ope
|
2014-08-03 18:02:51 -04:00
|
|
|
open('${1:path/or/url/or/pipe}', '${2:w}') { |${3:io}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
# path_from_here()
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet fpath
|
2014-08-03 18:02:51 -04:00
|
|
|
File.join(File.dirname(__FILE__), *['${1:rel path here}'])
|
2012-08-16 23:41:25 -04:00
|
|
|
# unix_filter {}
|
|
|
|
snippet unif
|
|
|
|
ARGF.each_line${1} do |${2:line}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# option_parse {}
|
|
|
|
snippet optp
|
2014-08-03 18:02:51 -04:00
|
|
|
require 'optparse'
|
2012-08-16 23:41:25 -04:00
|
|
|
|
2014-08-03 18:02:51 -04:00
|
|
|
options = { ${0:default: 'args'} }
|
2012-08-16 23:41:25 -04:00
|
|
|
|
|
|
|
ARGV.options do |opts|
|
2022-10-15 15:05:32 -04:00
|
|
|
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)}"
|
2014-08-03 18:02:51 -04:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet opt
|
2014-08-03 18:02:51 -04:00
|
|
|
opts.on('-${1:o}', '--${2:long-option-name}', ${3:String}, '${4:Option description.}') do |${5:opt}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet tc
|
2014-08-03 18:02:51 -04:00
|
|
|
require 'test/unit'
|
2012-08-16 23:41:25 -04:00
|
|
|
|
2014-08-03 18:02:51 -04:00
|
|
|
require '${1:library_file_name}'
|
2012-08-16 23:41:25 -04:00
|
|
|
|
|
|
|
class Test${2:$1} < Test::Unit::TestCase
|
|
|
|
def test_${3:case_name}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
snippet ts
|
2014-08-03 18:02:51 -04:00
|
|
|
require 'test/unit'
|
2012-08-16 23:41:25 -04:00
|
|
|
|
2014-08-03 18:02:51 -04:00
|
|
|
require 'tc_${1:test_case_file}'
|
|
|
|
require 'tc_${2:test_case_file}'
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet as
|
2014-08-03 18:02:51 -04:00
|
|
|
assert ${1:test}, '${2:Failure message.}'
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ase
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_equal ${1:expected}, ${2:actual}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asne
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_not_equal ${1:unexpected}, ${2:actual}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asid
|
2014-08-03 18:02:51 -04:00
|
|
|
assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2**-20}
|
2014-04-18 08:58:02 -04:00
|
|
|
snippet asi
|
|
|
|
assert_includes ${1:collection}, ${2:object}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asio
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_instance_of ${1:ExpectedClass}, ${2:actual_instance}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asko
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_kind_of ${1:ExpectedKind}, ${2:actual_instance}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asn
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_nil ${1:instance}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asnn
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_not_nil ${1:instance}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asm
|
2014-08-03 18:02:51 -04:00
|
|
|
assert_match(/${1:expected_pattern}/, ${2:actual_string})
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asnm
|
2014-08-03 18:02:51 -04:00
|
|
|
assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet aso
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_operator ${1:left}, :${2:operator}, ${3:right}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asr
|
2021-05-05 04:25:00 -04:00
|
|
|
assert_raises(${1:StandardError}) { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asrd
|
2021-05-05 04:25:00 -04:00
|
|
|
assert_raises ${1:StandardError} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet asnr
|
2021-05-05 04:25:00 -04:00
|
|
|
assert_nothing_raised(${1:StandardError}) { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asnrd
|
2021-05-05 04:25:00 -04:00
|
|
|
assert_nothing_raised ${1:StandardError} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet asrt
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_respond_to ${1:object}, :${2:method}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ass assert_same(..)
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_same ${1:expected}, ${2:actual}
|
2021-05-05 04:25:00 -04:00
|
|
|
snippet asss assert_send(..)
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_send [${1:object}, :${2:message}, ${3:args}]
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asns
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_not_same ${1:unexpected}, ${2:actual}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ast
|
2014-08-03 18:02:51 -04:00
|
|
|
assert_throws :${1:expected}, -> { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet astd
|
|
|
|
assert_throws :${1:expected} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet asnt
|
2013-11-16 14:45:48 -05:00
|
|
|
assert_nothing_thrown { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet asntd
|
|
|
|
assert_nothing_thrown do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet fl
|
2014-08-03 18:02:51 -04:00
|
|
|
flunk '${1:Failure message.}'
|
2021-05-05 04:25:00 -04:00
|
|
|
snippet rf
|
|
|
|
refute ${1:test}, '${2:Failure message.}'
|
|
|
|
snippet rfe
|
|
|
|
refute_equal ${1:unexpected}, ${2:actual}
|
|
|
|
snippet rfko
|
|
|
|
refute_kind_of ${1:UnexpectedKind}, ${2:actual_instance}
|
|
|
|
snippet rfn
|
|
|
|
refute_nil ${1:instance}
|
|
|
|
snippet rfo
|
|
|
|
refute_operator ${1:left}, :${2:operator}, ${3:right}
|
|
|
|
snippet rfi
|
|
|
|
refute_includes ${1:collection}, ${2:object}
|
|
|
|
snippet rfid
|
|
|
|
refute_in_delta ${1:unexpected_float}, ${2:actual_float}, ${3:2**-20}
|
|
|
|
snippet rfio
|
|
|
|
refute_instance_of ${1:UnexpectedClass}, ${2:actual_instance}
|
|
|
|
snippet rfs
|
|
|
|
refute_same ${1:unexpected}, ${2:actual}
|
2012-08-16 23:41:25 -04:00
|
|
|
# Benchmark.bmbm do .. end
|
|
|
|
snippet bm-
|
|
|
|
TESTS = ${1:10_000}
|
|
|
|
Benchmark.bmbm do |results|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet rep
|
2014-08-03 18:02:51 -04:00
|
|
|
results.report('${1:name}:') { TESTS.times { ${0} } }
|
2012-08-16 23:41:25 -04:00
|
|
|
# Marshal.dump(.., file)
|
|
|
|
snippet Md
|
2014-08-03 18:02:51 -04:00
|
|
|
File.open('${1:path/to/file.dump}', 'wb') { |${2:file}| Marshal.dump(${3:obj}, $2) }
|
2012-08-16 23:41:25 -04:00
|
|
|
# Mashal.load(obj)
|
|
|
|
snippet Ml
|
2014-08-03 18:02:51 -04:00
|
|
|
File.open('${1:path/to/file.dump}', 'rb') { |${2:file}| Marshal.load($2) }
|
2012-08-16 23:41:25 -04:00
|
|
|
# deep_copy(..)
|
|
|
|
snippet deec
|
2013-11-16 14:45:48 -05:00
|
|
|
Marshal.load(Marshal.dump(${1:obj_to_copy}))
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet Pn-
|
2014-08-03 18:02:51 -04:00
|
|
|
PStore.new('${1:file_name.pstore}')
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet tra
|
2013-11-16 14:45:48 -05:00
|
|
|
transaction(${1:true}) { ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
# xmlread(..)
|
|
|
|
snippet xml-
|
2014-08-03 18:02:51 -04:00
|
|
|
REXML::Document.new(File.read('${1:path/to/file}'))
|
2012-08-16 23:41:25 -04:00
|
|
|
# xpath(..) { .. }
|
|
|
|
snippet xpa
|
2014-08-03 18:02:51 -04:00
|
|
|
elements.each('${1://Xpath}') do |${2:node}|
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# class_from_name()
|
|
|
|
snippet clafn
|
2014-08-03 18:02:51 -04:00
|
|
|
split('::').inject(Object) { |par, const| par.const_get(const) }
|
2012-08-16 23:41:25 -04:00
|
|
|
# singleton_class()
|
|
|
|
snippet sinc
|
|
|
|
class << self; self end
|
|
|
|
snippet nam
|
2013-07-17 19:06:05 -04:00
|
|
|
namespace :${1:`vim_snippets#Filename()`} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet tas
|
2014-08-03 18:02:51 -04:00
|
|
|
desc '${1:Task description}'
|
|
|
|
task ${2:task_name: [:dependent, :tasks]} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
# block
|
|
|
|
snippet b
|
2013-11-16 14:45:48 -05:00
|
|
|
{ |${1:var}| ${0} }
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet begin
|
|
|
|
begin
|
2014-08-03 18:02:51 -04:00
|
|
|
fail 'A test exception.'
|
2021-05-05 04:25:00 -04:00
|
|
|
rescue StandardError => e
|
2012-08-16 23:41:25 -04:00
|
|
|
puts e.message
|
|
|
|
puts e.backtrace.inspect
|
|
|
|
else
|
|
|
|
# other exception
|
|
|
|
ensure
|
|
|
|
# always executed
|
|
|
|
end
|
|
|
|
|
|
|
|
#debugging
|
|
|
|
snippet debug
|
2014-09-27 11:32:18 -04:00
|
|
|
require 'byebug'; byebug
|
2022-08-08 09:45:56 -04:00
|
|
|
snippet dbg
|
|
|
|
require 'debug'; debugger
|
2014-09-27 11:32:18 -04:00
|
|
|
snippet debug19
|
|
|
|
require 'debugger'; debugger
|
|
|
|
snippet debug18
|
|
|
|
require 'ruby-debug'; debugger
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet pry
|
|
|
|
require 'pry'; binding.pry
|
2024-10-06 04:25:50 -04:00
|
|
|
snippet irb
|
|
|
|
binding.irb
|
2013-11-16 14:45:48 -05:00
|
|
|
snippet strf
|
2014-08-03 18:02:51 -04:00
|
|
|
strftime('${1:%Y-%m-%d %H:%M:%S %z}')${0}
|
|
|
|
#
|
|
|
|
# Minitest snippets
|
|
|
|
#
|
|
|
|
snippet mb
|
|
|
|
must_be ${0}
|
|
|
|
snippet wb
|
|
|
|
wont_be ${0}
|
|
|
|
snippet mbe
|
|
|
|
must_be_empty
|
|
|
|
snippet wbe
|
|
|
|
wont_be_empty
|
|
|
|
snippet mbio
|
|
|
|
must_be_instance_of ${0:Class}
|
|
|
|
snippet wbio
|
|
|
|
wont_be_instance_of ${0:Class}
|
|
|
|
snippet mbko
|
|
|
|
must_be_kind_of ${0:Class}
|
|
|
|
snippet wbko
|
|
|
|
wont_be_kind_of ${0:Class}
|
|
|
|
snippet mbn
|
|
|
|
must_be_nil
|
|
|
|
snippet wbn
|
|
|
|
wont_be_nil
|
|
|
|
snippet mbsa
|
|
|
|
must_be_same_as ${0:other}
|
|
|
|
snippet wbsa
|
|
|
|
wont_be_same_as ${0:other}
|
|
|
|
snippet mbsi
|
|
|
|
-> { ${0} }.must_be_silent
|
|
|
|
snippet mbwd
|
|
|
|
must_be_within_delta ${1:0.1}, ${2:0.1}
|
|
|
|
snippet wbwd
|
|
|
|
wont_be_within_delta ${1:0.1}, ${2:0.1}
|
|
|
|
snippet mbwe
|
|
|
|
must_be_within_epsilon ${1:0.1}, ${2:0.1}
|
|
|
|
snippet wbwe
|
|
|
|
wont_be_within_epsilon ${1:0.1}, ${2:0.1}
|
|
|
|
snippet me
|
|
|
|
must_equal ${0:other}
|
|
|
|
snippet we
|
|
|
|
wont_equal ${0:other}
|
|
|
|
snippet mi
|
|
|
|
must_include ${0:what}
|
|
|
|
snippet wi
|
|
|
|
wont_include ${0:what}
|
|
|
|
snippet mm
|
|
|
|
must_match /${0:regex}/
|
|
|
|
snippet wm
|
|
|
|
wont_match /${0:regex}/
|
|
|
|
snippet mout
|
|
|
|
-> { ${1} }.must_output '${0}'
|
|
|
|
snippet mra
|
2021-05-05 04:25:00 -04:00
|
|
|
-> { ${1} }.must_raise ${0:StandardError}
|
2014-08-03 18:02:51 -04:00
|
|
|
snippet mrt
|
|
|
|
must_respond_to :${0:method}
|
|
|
|
snippet wrt
|
|
|
|
wont_respond_to :${0:method}
|
|
|
|
snippet msend
|
|
|
|
must_send [ ${1:what}, :${2:method}, ${3:args} ]
|
|
|
|
snippet mthrow
|
|
|
|
-> { throw :${1:error} }.must_throw :${2:error}
|
2013-07-17 19:06:05 -04:00
|
|
|
##########################
|
|
|
|
# Rspec snippets #
|
|
|
|
##########################
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet desc
|
2013-11-16 14:45:48 -05:00
|
|
|
describe ${1:`substitute(substitute(vim_snippets#Filename(), '_spec$', '', ''), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2019-03-27 11:08:56 -04:00
|
|
|
snippet rdesc
|
|
|
|
RSpec.describe ${1:`substitute(substitute(vim_snippets#Filename(), '_spec$', '', ''), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
|
|
|
${0}
|
|
|
|
end
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet descm
|
2014-08-03 18:02:51 -04:00
|
|
|
describe '${1:#method}' do
|
|
|
|
${0:pending 'Not implemented'}
|
2013-07-17 19:06:05 -04:00
|
|
|
end
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet cont
|
2014-08-03 18:02:51 -04:00
|
|
|
context '${1:message}' do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet bef
|
|
|
|
before :${1:each} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
|
|
|
snippet aft
|
|
|
|
after :${1:each} do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
end
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet let
|
2014-07-02 07:18:18 -04:00
|
|
|
let(:${1:object}) { ${0} }
|
2013-05-04 16:32:47 -04:00
|
|
|
snippet let!
|
2014-07-02 07:18:18 -04:00
|
|
|
let!(:${1:object}) { ${0} }
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet subj
|
2013-11-16 14:45:48 -05:00
|
|
|
subject { ${0} }
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet s.
|
2013-11-16 14:45:48 -05:00
|
|
|
subject.${0:method}
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet spec
|
2013-11-16 14:45:48 -05:00
|
|
|
specify { subject.${0} }
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet exp
|
2013-11-16 14:45:48 -05:00
|
|
|
expect(${1:object}).to ${0}
|
|
|
|
snippet expb
|
|
|
|
expect { ${1:object} }.to ${0}
|
|
|
|
snippet experr
|
|
|
|
expect { ${1:object} }.to raise_error ${2:StandardError}, /${0:message_regex}/
|
2018-06-14 06:31:12 -04:00
|
|
|
snippet allow
|
|
|
|
allow(${1:object}).to ${0}
|
2013-04-13 13:45:21 -04:00
|
|
|
snippet shared
|
2014-08-03 18:02:51 -04:00
|
|
|
shared_examples ${0:'shared examples name'}
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet ibl
|
2014-08-03 18:02:51 -04:00
|
|
|
it_behaves_like ${0:'shared examples name'}
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet it
|
2014-08-03 18:02:51 -04:00
|
|
|
it '${1:spec_name}' do
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2013-07-17 19:06:05 -04:00
|
|
|
end
|
|
|
|
snippet its
|
2013-11-16 14:45:48 -05:00
|
|
|
its(:${1:method}) { should ${0} }
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet is
|
2013-11-16 14:45:48 -05:00
|
|
|
it { should ${0} }
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet isn
|
2013-11-16 14:45:48 -05:00
|
|
|
it { should_not ${0} }
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet iexp
|
2017-05-02 08:42:08 -04:00
|
|
|
it { expect(${1:object}).${2} ${0} }
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet iexpb
|
2017-05-02 08:42:08 -04:00
|
|
|
it { expect { ${1:object} }.${2} ${0} }
|
2015-07-13 06:22:46 -04:00
|
|
|
snippet iiexp
|
|
|
|
it { is_expected.to ${0} }
|
|
|
|
snippet iiexpn
|
|
|
|
it { is_expected.not_to ${0} }
|
2016-03-14 06:04:57 -04:00
|
|
|
snippet agg
|
|
|
|
aggregate_failures '${1:message}' do
|
|
|
|
${0}
|
|
|
|
end
|