├── !env ├── # ├── .yas-make-groups ├── .yas-parents ├── : ├── =b ├── Array ├── Comp ├── Dir ├── Enum ├── File ├── File.1 ├── File.2 ├── Forw- ├── Hash ├── Md ├── Ml ├── Pn- ├── README.markdown ├── Yd- ├── Yl- ├── aa ├── ae ├── ako ├── all ├── am ├── ann ├── any ├── app ├── ar ├── ars ├── art ├── as ├── ase ├── asid ├── asio ├── asko ├── asm ├── asn ├── asne ├── asnm ├── asnn ├── asnr ├── asns ├── asnt ├── aso ├── asr ├── asrt ├── ass ├── ass.1 ├── ast ├── begin ├── bm ├── bm- ├── bt ├── case ├── cl ├── cla ├── cla- ├── cla.1 ├── cla.2 ├── cla.3 ├── cla.4 ├── clafn ├── classify ├── cls ├── col ├── collect ├── dee ├── deec ├── def ├── defd ├── defds ├── defmm ├── defs ├── deft ├── deli ├── desc ├── det ├── do ├── dow ├── ea ├── eab ├── eac ├── eac- ├── eai ├── eak ├── eal ├── eap ├── eas- ├── eav ├── eawi ├── fet ├── fil ├── filedn ├── fin ├── fina ├── fl ├── flao ├── flsh ├── forin ├── gre ├── gsu ├── hm ├── ho ├── i ├── if ├── ife ├── inj ├── inject ├── lam ├── logi ├── loo ├── map ├── mapwi- ├── max ├── min ├── mm ├── mod ├── mod.1 ├── module ├── nam ├── ope ├── opt ├── optp ├── par ├── patfh ├── pend ├── r ├── ra ├── ral ├── ran ├── rb ├── rcea ├── rcec ├── rceca ├── rea ├── reai ├── rec ├── reca ├── recai ├── rej ├── reject ├── rep ├── req ├── res ├── reve ├── rf ├── rfu ├── ri ├── ril ├── rit ├── rl ├── rn ├── rns ├── rp ├── rpc ├── rpl ├── rpo ├── rps ├── rreq ├── rspec-mode ├── aft ├── annot ├── anr ├── anra ├── anrb ├── ant ├── any ├── atl ├── atm ├── bef ├── befm ├── bfe ├── conn ├── des ├── desc ├── desrc.delete ├── desrc.get ├── desrc.post ├── desrc.put ├── dest ├── dests ├── ex ├── fm ├── fmar ├── it ├── its ├── mat ├── mocw.flexmock ├── mocw.mocha ├── mocw.rr ├── on ├── resh ├── sce ├── set ├── sh= ├── shb ├── shbc ├── shbio ├── shbko ├── shbr ├── shbs ├── she.eql ├── she.equal ├── shh ├── shhal ├── shham ├── shhr ├── shm.match ├── shn= ├── shnb ├── shnbc ├── shnbio ├── shnbko ├── shnbr ├── shnbs ├── shne.eql ├── shne.equal ├── shnm.match ├── shnp ├── shnr ├── shnre ├── shnrt ├── shns ├── shnt ├── shp ├── shr ├── shre ├── shrt ├── shrt.redirect ├── shrt.render ├── shrt.respond ├── shs ├── sht ├── sto ├── stub ├── tw └── wia ├── rt ├── rtl ├── rtlt ├── rts ├── rw ├── sca ├── sel ├── select ├── ses ├── sinc ├── sor ├── sorb ├── sr ├── ste ├── sub ├── task ├── task.1 ├── tc ├── tim ├── tra ├── ts ├── unif ├── unless ├── until ├── upt ├── usai ├── usau ├── va ├── vc ├── ve ├── vf ├── vi ├── vn ├── vp ├── vu ├── w ├── when ├── while ├── xml- ├── xpa ├── y ├── zip └── { /!env: -------------------------------------------------------------------------------- 1 | #name : /usr/bin/env ruby 2 | # key: !env 3 | # -- 4 | #!/usr/bin/env ruby 5 | -------------------------------------------------------------------------------- /#: -------------------------------------------------------------------------------- 1 | #name : # => 2 | # key: # 3 | # -- 4 | # => -------------------------------------------------------------------------------- /.yas-make-groups: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmaland/yasnippet-ruby-mode/2942231908ef4b8f3335459887c0ac4c8871d611/.yas-make-groups -------------------------------------------------------------------------------- /.yas-parents: -------------------------------------------------------------------------------- 1 | text-mode 2 | -------------------------------------------------------------------------------- /:: -------------------------------------------------------------------------------- 1 | #name : :key => "value" 2 | # key: : 3 | # -- 4 | :${key} => ${"value"} -------------------------------------------------------------------------------- /=b: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | $0 3 | =end -------------------------------------------------------------------------------- /Array: -------------------------------------------------------------------------------- 1 | #name : Array.new(10) { |i| ... } 2 | #group : Arrays 3 | # key: Array 4 | # -- 5 | Array.new(${10}) { |${i}| $0 } -------------------------------------------------------------------------------- /Comp: -------------------------------------------------------------------------------- 1 | #name : include Comparable; def <=> ... end 2 | # key: Comp 3 | # -- 4 | include Comparable 5 | 6 | def <=> other 7 | $0 8 | end -------------------------------------------------------------------------------- /Dir: -------------------------------------------------------------------------------- 1 | #name : Dir.glob("..") do |file| .. end 2 | #group : Files 3 | # key: Dir 4 | # -- 5 | Dir.glob(${1:"dir/glob/*}") { |${2:file}| $0 } -------------------------------------------------------------------------------- /Enum: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: Enum 4 | # -- 5 | include Enumerable 6 | 7 | def each(&block) 8 | $0 9 | end -------------------------------------------------------------------------------- /File: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Files 3 | # key: File 4 | # -- 5 | File.foreach(${1:"${2:path/to/file}"}) { |${3:line}| $0 } -------------------------------------------------------------------------------- /File.1: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Files 3 | # key: File.1 4 | # -- 5 | File.open(${1:"${2:path/to/file}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:file}| $0 } -------------------------------------------------------------------------------- /File.2: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Files 3 | # key: File.2 4 | # -- 5 | File.read(${1:"${2:path/to/file}"}) -------------------------------------------------------------------------------- /Forw-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: Forw- 3 | # -- 4 | extend Forwardable -------------------------------------------------------------------------------- /Hash: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Hashes 3 | # key: Hash 4 | # -- 5 | Hash.new { |${1:hash}, ${2:key}| ${1:hash}[${2:key}] = $0 } -------------------------------------------------------------------------------- /Md: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: Md 3 | # -- 4 | File.open(${1:"${2:path/to/file}.dump"}, "w") { |${3:file}| Marshal.dump(${4:obj}, ${3:file}) } -------------------------------------------------------------------------------- /Ml: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: Ml 3 | # -- 4 | File.open(${1:"${2:path/to/file}.dump"}) { |${3:file}| Marshal.load(${3:file}) } -------------------------------------------------------------------------------- /Pn-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: Pn- 3 | # -- 4 | PStore.new(${1:"${2:file_name.pstore}"}) -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Snippets for Ruby Mode 2 | 3 | ## About 4 | 5 | Comprehensive collection of Ruby snippets for 6 | [yasnippet](http://code.google.com/p/yasnippet/ "yasnippet - Google Code"). 7 | The collection also contains snippets for major Ruby frameworks like Rails 8 | and RSpec. 9 | 10 | The Rails snippets were originally borrowed from 11 | [mknittig/yasnippet-rails](http://github.com/eschulte/yasnippets-rails/tree/master). 12 | 13 | The RSpec snippets require that RSpec files are edited in a separate 14 | Emacs mode. I recommend using 15 | [rspec-mode](http://github.com/pezra/rspec-mode/tree/master). 16 | The RSpec snippets were originally borrowed from 17 | [gary/yasnippets-rspec](http://github.com/gary/yasnippets-rspec/tree/master). 18 | 19 | ## Contributors 20 | 21 | See https://github.com/bmaland/yasnippet-ruby-mode/contributors 22 | 23 | Much of the credits should naturally go to the yasnippet-rails and 24 | yasnippet-rspec authors. 25 | 26 | Thanks to Jeff Wheeler for his work on the snippet_copier.py script! 27 | -------------------------------------------------------------------------------- /Yd-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: Yd- 3 | # -- 4 | File.open(${1:"${2:path/to/file}.yaml"}, "w") { |${3:file}| YAML.dump(${4:obj}, ${3:file}) } -------------------------------------------------------------------------------- /Yl-: -------------------------------------------------------------------------------- 1 | #name : YAML.load(file) 2 | # key: Yl- 3 | # -- 4 | File.open("${1:path/to/file.yaml}") { |${2:file}| YAML.load(${2:file}) } -------------------------------------------------------------------------------- /aa: -------------------------------------------------------------------------------- 1 | #name : attr_accesor :... 2 | # key: aa 3 | # -- 4 | attr_accessor :$0 -------------------------------------------------------------------------------- /ae: -------------------------------------------------------------------------------- 1 | #name : assert_equal ... , ... 2 | #group: assert 3 | # key: ae 4 | # -- 5 | assert_equal ${expected}, ${actual} 6 | -------------------------------------------------------------------------------- /ako: -------------------------------------------------------------------------------- 1 | #name : assert_kind_of ... , ... 2 | #group: assert 3 | # key: ako 4 | # -- 5 | assert_kind_of ${class}, ${object} 6 | -------------------------------------------------------------------------------- /all: -------------------------------------------------------------------------------- 1 | #name : all? { |...| ... } 2 | #group : Enumerables 3 | # key: all 4 | # -- 5 | all? { |${e}| $0 } -------------------------------------------------------------------------------- /am: -------------------------------------------------------------------------------- 1 | #name : alias_method new, old 2 | # key: am 3 | # -- 4 | alias_method :${new_name}, :${old_name} -------------------------------------------------------------------------------- /ann: -------------------------------------------------------------------------------- 1 | #name : assert_not_nil ... 2 | #group: assert 3 | # key: ann 4 | # -- 5 | assert_not_nil ${object} 6 | -------------------------------------------------------------------------------- /any: -------------------------------------------------------------------------------- 1 | #name : any? { |...| ... } 2 | #group : Enumerables 3 | # key: any 4 | # -- 5 | any? { |${e}| $0 } -------------------------------------------------------------------------------- /app: -------------------------------------------------------------------------------- 1 | #name : if __FILE__ == $PROGRAM_NAME ... end 2 | # key: app 3 | # -- 4 | if __FILE__ == $PROGRAM_NAME 5 | $0 6 | end -------------------------------------------------------------------------------- /ar: -------------------------------------------------------------------------------- 1 | #name : attr_reader :... 2 | # key: ar 3 | # -- 4 | attr_reader :$0 -------------------------------------------------------------------------------- /ars: -------------------------------------------------------------------------------- 1 | #name : assert_response : ... 2 | #group: assert 3 | # key: ars 4 | # -- 5 | assert_response :${success} 6 | -------------------------------------------------------------------------------- /art: -------------------------------------------------------------------------------- 1 | #name : assert_redirected_to :controller => " ... " 2 | #group: assert 3 | # key: art 4 | # -- 5 | assert_redirected_to :controller => "${controller}" 6 | -------------------------------------------------------------------------------- /as: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: as 4 | # -- 5 | assert`snippet_paren.rb`${1:test}, "${0:Failure message.}"`snippet_paren.rb end` -------------------------------------------------------------------------------- /ase: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: ase 4 | # -- 5 | assert_equal`snippet_paren.rb`${1:expected}, ${0:actual}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asid: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asid 4 | # -- 5 | assert_in_delta`snippet_paren.rb`${1:expected_float}, ${2:actual_float}, ${0:2 ** -20}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asio: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asio 4 | # -- 5 | assert_instance_of`snippet_paren.rb`${1:ExpectedClass}, ${0:actual_instance}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asko: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asko 4 | # -- 5 | assert_kind_of`snippet_paren.rb`${1:ExpectedKind}, ${0:actual_instance}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asm: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asm 4 | # -- 5 | assert_match`snippet_paren.rb`/${1:expected_pattern}/, ${0:actual_string}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asn: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asn 4 | # -- 5 | assert_nil`snippet_paren.rb`${0:instance}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asne: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asne 4 | # -- 5 | assert_not_equal`snippet_paren.rb`${1:unexpected}, ${0:actual}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asnm: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asnm 4 | # -- 5 | assert_no_match`snippet_paren.rb`/${1:unexpected_pattern}/, ${0:actual_string}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asnn: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asnn 4 | # -- 5 | assert_not_nil`snippet_paren.rb`${0:instance}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asnr: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asnr 4 | # -- 5 | assert_nothing_raised(${1:Exception}) { $0 } -------------------------------------------------------------------------------- /asns: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asns 4 | # -- 5 | assert_not_same`snippet_paren.rb`${1:unexpected}, ${0:actual}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asnt: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asnt 4 | # -- 5 | assert_nothing_thrown { $0 } -------------------------------------------------------------------------------- /aso: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: aso 4 | # -- 5 | assert_operator`snippet_paren.rb`${1:left}, :${2:operator}, ${0:right}`snippet_paren.rb end` -------------------------------------------------------------------------------- /asr: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asr 4 | # -- 5 | assert_raise(${1:Exception}) { $0 } -------------------------------------------------------------------------------- /asrt: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: asrt 4 | # -- 5 | assert_respond_to`snippet_paren.rb`${1:object}, :${0:method}`snippet_paren.rb end` -------------------------------------------------------------------------------- /ass: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: ass 4 | # -- 5 | assert_same`snippet_paren.rb`${1:expected}, ${0:actual}`snippet_paren.rb end` -------------------------------------------------------------------------------- /ass.1: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: ass.1 4 | # -- 5 | assert_send`snippet_paren.rb`[${1:object}, :${2:message}, ${0:args}]`snippet_paren.rb end` -------------------------------------------------------------------------------- /ast: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Tests 3 | # key: ast 4 | # -- 5 | assert_throws(:${1:expected}) { $0 } -------------------------------------------------------------------------------- /begin: -------------------------------------------------------------------------------- 1 | #name : begin ... rescue ... end 2 | #group : Blocks 3 | # key: begin 4 | # -- 5 | begin 6 | $3 7 | rescue ${1:Exception} => ${2:e} 8 | $0 9 | end -------------------------------------------------------------------------------- /bm: -------------------------------------------------------------------------------- 1 | #name : Benchmark.bmbm(...) do ... end 2 | # key: bm 3 | # -- 4 | Benchmark.bmbm(${1:10}) do |x| 5 | $0 6 | end -------------------------------------------------------------------------------- /bm-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: bm- 3 | # -- 4 | TESTS = ${1:10_000} 5 | Benchmark.bmbm do |results| 6 | $0 7 | end -------------------------------------------------------------------------------- /bt: -------------------------------------------------------------------------------- 1 | #name : belongs_to : ... 2 | #group: ActiveRecord 3 | # key: bt 4 | # -- 5 | belongs_to :${class} 6 | -------------------------------------------------------------------------------- /case: -------------------------------------------------------------------------------- 1 | #name : case ... end 2 | #group : Conditions 3 | # key: case 4 | # -- 5 | case ${1:object} 6 | when ${2:condition} 7 | $0 8 | end -------------------------------------------------------------------------------- /cl: -------------------------------------------------------------------------------- 1 | #name : classify { |...| ... } 2 | # key: cl 3 | # -- 4 | classify { |${e}| $0 } -------------------------------------------------------------------------------- /cla: -------------------------------------------------------------------------------- 1 | #name : class << self ... end 2 | #group : definitions 3 | # key: cla 4 | # -- 5 | class << ${self} 6 | $0 7 | end -------------------------------------------------------------------------------- /cla-: -------------------------------------------------------------------------------- 1 | #name : class .. < DelegateClass .. initialize .. end (class) 2 | #group : definitions 3 | # key: cla- 4 | # -- 5 | class ${1:ClassName} < DelegateClass(${2:ParentClass}) 6 | def initialize(${3:args}) 7 | super(${4:del_obj}) 8 | 9 | $0 10 | end 11 | 12 | 13 | end -------------------------------------------------------------------------------- /cla.1: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : definitions 3 | # key: cla.1 4 | # -- 5 | ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} = Struct.new(:${2:attr_names}) do 6 | def ${3:method_name} 7 | $0 8 | end 9 | 10 | 11 | end -------------------------------------------------------------------------------- /cla.2: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : definitions 3 | # key: cla.2 4 | # -- 5 | class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} 6 | $0 7 | end -------------------------------------------------------------------------------- /cla.3: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : definitions 3 | # key: cla.3 4 | # -- 5 | class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} 6 | def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/} 7 | $0 8 | end 9 | 10 | 11 | end -------------------------------------------------------------------------------- /cla.4: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : definitions 3 | # key: cla.4 4 | # -- 5 | class ${1:BlankSlate} 6 | instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ } 7 | 8 | def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/} 9 | @${3:delegate} = ${4:delegate_object} 10 | 11 | $0 12 | end 13 | 14 | def method_missing(meth, *args, &block) 15 | @${3:delegate}.send(meth, *args, &block) 16 | end 17 | 18 | 19 | end -------------------------------------------------------------------------------- /clafn: -------------------------------------------------------------------------------- 1 | #name : class_from_name() 2 | # key: clafn 3 | # -- 4 | split("::").inject(Object) { |par, const| par.const_get(const) } -------------------------------------------------------------------------------- /classify: -------------------------------------------------------------------------------- 1 | #name : classify { |...| ... } 2 | #group : collections 3 | # key: classify 4 | # -- 5 | classify { |${e}| $0 } -------------------------------------------------------------------------------- /cls: -------------------------------------------------------------------------------- 1 | # name: class ... end 2 | # contributor: hitesh 3 | # key: cls 4 | # -- 5 | class ${1:`(let ((fn (capitalize (file-name-nondirectory 6 | (file-name-sans-extension 7 | (or (buffer-file-name) 8 | (buffer-name (current-buffer)))))))) 9 | (cond 10 | ((string-match "_" fn) (replace-match "" nil nil fn)) 11 | (t fn)))`} 12 | $0 13 | end 14 | -------------------------------------------------------------------------------- /col: -------------------------------------------------------------------------------- 1 | #name : collect { |e| ... } 2 | #group : Enumerables 3 | # key: col 4 | # -- 5 | collect { |${e}| $0 } 6 | -------------------------------------------------------------------------------- /collect: -------------------------------------------------------------------------------- 1 | #name : collect { |...| ... } 2 | #group : Enumerables 3 | # key: collect 4 | # -- 5 | collect { |${e}| $0 } -------------------------------------------------------------------------------- /dee: -------------------------------------------------------------------------------- 1 | #name : deep_copy(...) 2 | # key: dee 3 | # -- 4 | Marshal.load(Marshal.dump($0)) -------------------------------------------------------------------------------- /deec: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: deec 3 | # -- 4 | Marshal.load(Marshal.dump(${0:obj_to_copy})) -------------------------------------------------------------------------------- /def: -------------------------------------------------------------------------------- 1 | #name : def ... end 2 | #group : definitions 3 | # key: def 4 | # -- 5 | def ${1:method_name} 6 | $0 7 | end -------------------------------------------------------------------------------- /defd: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: defd 3 | # -- 4 | def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name} -------------------------------------------------------------------------------- /defds: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: defds 3 | # -- 4 | def_delegators :${1:@del_obj}, :${0:del_methods} -------------------------------------------------------------------------------- /defmm: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: defmm 3 | # -- 4 | def method_missing(meth, *args, &blk) 5 | $0 6 | end -------------------------------------------------------------------------------- /defs: -------------------------------------------------------------------------------- 1 | #name : def.self ... end 2 | # key: defs 3 | # -- 4 | def self.${1:class_method_name} 5 | $0 6 | end -------------------------------------------------------------------------------- /deft: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: deft 3 | # -- 4 | def test_${1:case_name} 5 | $0 6 | end -------------------------------------------------------------------------------- /deli: -------------------------------------------------------------------------------- 1 | #name : delete_if { |...| ... } 2 | # key: deli 3 | # -- 4 | delete_if { |${e} $0 } -------------------------------------------------------------------------------- /desc: -------------------------------------------------------------------------------- 1 | #name : describe (rspec) 2 | # key: desc 3 | # -- 4 | describe "${1:method}" do 5 | it$0 6 | end -------------------------------------------------------------------------------- /det: -------------------------------------------------------------------------------- 1 | #name : detect { |...| ... } 2 | #group : Enumerables 3 | # key: det 4 | # -- 5 | detect { |${e}| $0 } -------------------------------------------------------------------------------- /do: -------------------------------------------------------------------------------- 1 | #name : do |variable| ... end 2 | #group : Blocks 3 | # key: do 4 | # -- 5 | do |${1:variable}| 6 | $0 7 | end -------------------------------------------------------------------------------- /dow: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Loops 3 | # key: dow 4 | # -- 5 | downto(${1:0}) { ${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:| )/}$0 } -------------------------------------------------------------------------------- /ea: -------------------------------------------------------------------------------- 1 | #name : each { |...| ... } 2 | # key: ea 3 | # -- 4 | each { |${e}| $0 } -------------------------------------------------------------------------------- /eab: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: eab 3 | # -- 4 | each_byte { |${1:byte}| $0 } -------------------------------------------------------------------------------- /eac: -------------------------------------------------------------------------------- 1 | #name : each_cons(...) { |...| ... } 2 | #group : Enumerables 3 | # key: eac 4 | # -- 5 | each_cons(${1:2}) { |${group}| $0 } -------------------------------------------------------------------------------- /eac-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: eac- 3 | # -- 4 | each_char { |${1:chr}| $0 } -------------------------------------------------------------------------------- /eai: -------------------------------------------------------------------------------- 1 | #name : each_index { |i| ... } 2 | # key: eai 3 | # -- 4 | each_index { |${i}| $0 } -------------------------------------------------------------------------------- /eak: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: eak 3 | # -- 4 | each_key { |${1:key}| $0 } -------------------------------------------------------------------------------- /eal: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: eal 3 | # -- 4 | each_line$1 { |${2:line}| $0 } -------------------------------------------------------------------------------- /eap: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: eap 3 | # -- 4 | each_pair { |${1:name}, ${2:val}| $0 } -------------------------------------------------------------------------------- /eas-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: eas- 4 | # -- 5 | each_slice(${1:2}) { |${2:group}| $0 } -------------------------------------------------------------------------------- /eav: -------------------------------------------------------------------------------- 1 | #name : each_value { |val| ... } 2 | # key: eav 3 | # -- 4 | each_value { |${val}| $0 } -------------------------------------------------------------------------------- /eawi: -------------------------------------------------------------------------------- 1 | #name : each_with_index { |e, i| ... } 2 | #group : Enumerables 3 | # key: eawi 4 | # -- 5 | each_with_index { |${e}, ${i}| $0 } -------------------------------------------------------------------------------- /fet: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: fet 3 | # -- 4 | fetch(${1:name}) { ${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/}${2:key}${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:| )/}$0 } -------------------------------------------------------------------------------- /fil: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: fil 3 | # -- 4 | fill(${1:range}) { ${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/}${2:i}${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:| )/}$0 } -------------------------------------------------------------------------------- /filedn: -------------------------------------------------------------------------------- 1 | #name : File.dirname(__FILE__) 2 | #group : Files 3 | # key: filedn 4 | # -- 5 | File.dirname(${1:__FILE__}) + "/$0" -------------------------------------------------------------------------------- /fin: -------------------------------------------------------------------------------- 1 | #name : find { |e| .. } 2 | #group : Enumerables 3 | # key: fin 4 | # -- 5 | find { |${1:e}| $0 } -------------------------------------------------------------------------------- /fina: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: fina 4 | # -- 5 | find_all { |${1:e}| $0 } -------------------------------------------------------------------------------- /fl: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: fl 3 | # -- 4 | flunk`snippet_paren.rb`"${0:Failure message.}"`snippet_paren.rb end` -------------------------------------------------------------------------------- /flao: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Arrays 3 | # key: flao 4 | # -- 5 | inject(Array.new) { |${1:arr}, ${2:a}| ${1:arr}.push(*${2:a}) } -------------------------------------------------------------------------------- /flsh: -------------------------------------------------------------------------------- 1 | #name : flash[: ... ] = " ... " 2 | #group: Rails 3 | # key: flsh 4 | # -- 5 | flash[:${notice}] = "${Text here...}" 6 | -------------------------------------------------------------------------------- /forin: -------------------------------------------------------------------------------- 1 | #name : for ... in ...; ... end 2 | #group : Loops 3 | # key: forin 4 | # -- 5 | for ${1:element} in ${2:collection} 6 | $0 7 | end -------------------------------------------------------------------------------- /gre: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: gre 4 | # -- 5 | grep(${1:/${2:pattern}/}) { |${3:match}| $0 } -------------------------------------------------------------------------------- /gsu: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: gsu 3 | # -- 4 | gsub(/${1:pattern}/) { ${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/}${2:match}${2/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:| )/}$0 } -------------------------------------------------------------------------------- /hm: -------------------------------------------------------------------------------- 1 | #name : has_many : ... 2 | #group: ActiveRecord 3 | # key: hm 4 | # -- 5 | has_many :${class} 6 | -------------------------------------------------------------------------------- /ho: -------------------------------------------------------------------------------- 1 | #name : has_one : ... 2 | #group: ActiveRecord 3 | # key: ho 4 | # -- 5 | has_one :${class} 6 | -------------------------------------------------------------------------------- /i: -------------------------------------------------------------------------------- 1 | #name : def initialize(...) ... end 2 | # key: i 3 | # -- 4 | def initialize(${1:params}) 5 | ${2:body} 6 | end 7 | $0 -------------------------------------------------------------------------------- /if: -------------------------------------------------------------------------------- 1 | # -*- mode: yasnippet -*- 2 | #name : if ... end 3 | #group : Conditions 4 | # key: if 5 | # -- 6 | if ${1:condition} 7 | $0 8 | end -------------------------------------------------------------------------------- /ife: -------------------------------------------------------------------------------- 1 | #name : if ... else ... end 2 | #group : Conditions 3 | # key: ife 4 | # -- 5 | if ${1:condition} 6 | $2 7 | else 8 | $3 9 | end -------------------------------------------------------------------------------- /inj: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: inj 4 | # -- 5 | inject${1/.+/(/}${1:init}${1/.+/)/} { |${2:mem}, ${3:var}| $0 } -------------------------------------------------------------------------------- /inject: -------------------------------------------------------------------------------- 1 | #name : inject(...) { |...| ... } 2 | #group : Enumerables 3 | # key: inject 4 | # -- 5 | inject(${1:0}) { |${2:injection}, ${3:element}| $0 } -------------------------------------------------------------------------------- /lam: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: lam 3 | # -- 4 | lambda { ${1/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/}${1:args}${1/(^(?\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:| )/}$0 } -------------------------------------------------------------------------------- /logi: -------------------------------------------------------------------------------- 1 | #name : logger.info " ... " 2 | #group: general 3 | # key: logi 4 | # -- 5 | logger.info "${Text here...}" 6 | -------------------------------------------------------------------------------- /loo: -------------------------------------------------------------------------------- 1 | #name : loop { .. } 2 | #group : Loops 3 | # key: loo 4 | # -- 5 | loop { $0 } -------------------------------------------------------------------------------- /map: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: map 4 | # -- 5 | map { |${1:e}| $0 } -------------------------------------------------------------------------------- /mapwi-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: mapwi- 4 | # -- 5 | enum_with_index.map { |${1:e}, ${2:i}| $0 } -------------------------------------------------------------------------------- /max: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: max 4 | # -- 5 | max { |a, b| $0 } -------------------------------------------------------------------------------- /min: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: min 4 | # -- 5 | min { |a, b| $0 } -------------------------------------------------------------------------------- /mm: -------------------------------------------------------------------------------- 1 | #name : def method_missing ... end 2 | # key: mm 3 | # -- 4 | def method_missing(method, *args) 5 | $0 6 | end -------------------------------------------------------------------------------- /mod: -------------------------------------------------------------------------------- 1 | #name : module ModuleName ... end 2 | # key: mod 3 | # -- 4 | module ${ModuleName} 5 | $0 6 | end 7 | -------------------------------------------------------------------------------- /mod.1: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: mod.1 3 | # -- 4 | module ${1:ModuleName} 5 | module ClassMethods 6 | $0 7 | end 8 | 9 | module InstanceMethods 10 | 11 | end 12 | 13 | def self.included(receiver) 14 | receiver.extend ClassMethods 15 | receiver.send :include, InstanceMethods 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /module: -------------------------------------------------------------------------------- 1 | #name : module ModuleName ... end 2 | # key: module 3 | # -- 4 | module ${ModuleName} 5 | $0 6 | end 7 | -------------------------------------------------------------------------------- /nam: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: nam 3 | # -- 4 | namespace :${1:${TM_FILENAME/\.\w+//}} do 5 | $0 6 | end -------------------------------------------------------------------------------- /ope: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: ope 3 | # -- 4 | open(${1:"${2:path/or/url/or/pipe}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:io}| $0 } -------------------------------------------------------------------------------- /opt: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: opt 3 | # -- 4 | opts.on( "-${1:o}", "--${2:long-option-name}"${3/^\s*$|(.*\S.*)/(?1:, )/}${3:String}, 5 | "${4:Option description.}" ) do |${6:opt}| 6 | $0 7 | end -------------------------------------------------------------------------------- /optp: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: optp 3 | # -- 4 | require "optparse" 5 | 6 | options = {${1::default => "args"}} 7 | 8 | ARGV.options do |opts| 9 | opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2/^\s*$|(.*\S.*)/(?1: )/}${2:OTHER_ARGS}" 10 | 11 | opts.separator "" 12 | opts.separator "Specific Options:" 13 | 14 | $0 15 | 16 | opts.separator "Common Options:" 17 | 18 | opts.on( "-h", "--help", 19 | "Show this message." ) do 20 | puts opts 21 | exit 22 | end 23 | 24 | begin 25 | opts.parse! 26 | rescue 27 | puts opts 28 | exit 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /par: -------------------------------------------------------------------------------- 1 | #name : params[: ... ] 2 | #group: Rails 3 | # key: par 4 | # -- 5 | params[:${id}] 6 | -------------------------------------------------------------------------------- /patfh: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: patfh 3 | # -- 4 | File.join(File.dirname(__FILE__), *%w[${1:rel path here}]) -------------------------------------------------------------------------------- /pend: -------------------------------------------------------------------------------- 1 | #name : program end 2 | # key: pend 3 | # -- 4 | __END__ 5 | -------------------------------------------------------------------------------- /r: -------------------------------------------------------------------------------- 1 | #name : attr_reader ... 2 | # key: r 3 | # -- 4 | attr_reader : -------------------------------------------------------------------------------- /ra: -------------------------------------------------------------------------------- 1 | #name : render :action => " ... " 2 | #group: Rails render 3 | # key: ra 4 | # -- 5 | render :action => "${action}" 6 | -------------------------------------------------------------------------------- /ral: -------------------------------------------------------------------------------- 1 | #name : render :action => " ... ", :layout => " ... " 2 | #group: Rails render 3 | # key: ral 4 | # -- 5 | render :action => "${action}", :layout => "${layoutname}" 6 | -------------------------------------------------------------------------------- /ran: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | #group : Enumerables 3 | # key: ran 4 | # -- 5 | sort_by { rand } -------------------------------------------------------------------------------- /rb: -------------------------------------------------------------------------------- 1 | #name : /usr/bin/ruby -wKU 2 | #group : general 3 | # key: rb 4 | # -- 5 | #!/usr/bin/ruby -wKU 6 | -------------------------------------------------------------------------------- /rcea: -------------------------------------------------------------------------------- 1 | #name : render_component :action => " ... " 2 | #group: Rails render 3 | # key: rcea 4 | # -- 5 | render_component :action => "${index}" 6 | -------------------------------------------------------------------------------- /rcec: -------------------------------------------------------------------------------- 1 | #name : render_component :controller => " ... " 2 | #group: Rails render 3 | # key: rcec 4 | # -- 5 | render_component :controller => "${items}" 6 | -------------------------------------------------------------------------------- /rceca: -------------------------------------------------------------------------------- 1 | #name : render_component :controller => " ... ", :action => " ... " 2 | #group: Rails render 3 | # key: rceca 4 | # -- 5 | render_component :controller => "${items}", :action => "${index}" 6 | -------------------------------------------------------------------------------- /rea: -------------------------------------------------------------------------------- 1 | #name : redirect_to :action => " ... " 2 | #group: Rails redirect 3 | # key: rea 4 | # -- 5 | redirect_to :action => "${index}" 6 | -------------------------------------------------------------------------------- /reai: -------------------------------------------------------------------------------- 1 | #name : redirect_to :action => " ... ", :id => ... 2 | #group: Rails redirect 3 | # key: reai 4 | # -- 5 | redirect_to :action => "${show}", :id => ${@item} 6 | -------------------------------------------------------------------------------- /rec: -------------------------------------------------------------------------------- 1 | #name : redirect_to :controller => " ... " 2 | #group: Rails redirect 3 | # key: rec 4 | # -- 5 | redirect_to :controller => "${items}" 6 | -------------------------------------------------------------------------------- /reca: -------------------------------------------------------------------------------- 1 | #name : redirect_to :controller => " ... ", :action => " ... " 2 | #group: Rails redirect 3 | # key: reca 4 | # -- 5 | redirect_to :controller => "${items}", :action => "${list}" 6 | -------------------------------------------------------------------------------- /recai: -------------------------------------------------------------------------------- 1 | #name : redirect_to :controller => " ... ", :action => " ... ", :id => ... 2 | #group: Rails redirect 3 | # key: recai 4 | # -- 5 | redirect_to :controller => "${items}", :action => "${show}", :id => ${@item} 6 | -------------------------------------------------------------------------------- /rej: -------------------------------------------------------------------------------- 1 | #name : reject { |e| .. } 2 | #group : Enumerables 3 | # key: rej 4 | # -- 5 | reject { |${1:e}| $0 } -------------------------------------------------------------------------------- /reject: -------------------------------------------------------------------------------- 1 | #name : reject { |...| ... } 2 | #group : Enumerables 3 | # key: reject 4 | # -- 5 | reject { |${1:element}| $0 } -------------------------------------------------------------------------------- /rep: -------------------------------------------------------------------------------- 1 | #name : results_report(..) { .. } 2 | # key: rep 3 | # -- 4 | results.report("${1:name}:") { TESTS.times { $0 } } -------------------------------------------------------------------------------- /req: -------------------------------------------------------------------------------- 1 | #name : require "..." 2 | # key: req 3 | # -- 4 | require "$0" -------------------------------------------------------------------------------- /res: -------------------------------------------------------------------------------- 1 | # -*- mode: yasnippet -*- 2 | #name : respond_to do |format| .. 3 | #group : ActionController 4 | #contributor : Bjørn Arild Mæland [github.com/bmaland] 5 | # key: res 6 | # -- 7 | respond_to do |format| 8 | format.${1:html} $0 9 | end 10 | -------------------------------------------------------------------------------- /reve: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: reve 3 | # -- 4 | reverse_each { |${1:e}| $0 } -------------------------------------------------------------------------------- /rf: -------------------------------------------------------------------------------- 1 | #name : render :file => " ... " 2 | #group: Rails render 3 | # key: rf 4 | # -- 5 | render :file => "${filepath}" 6 | -------------------------------------------------------------------------------- /rfu: -------------------------------------------------------------------------------- 1 | #name : render :file => " ... ", :use_full_path => ... 2 | #group: Rails render 3 | # key: rfu 4 | # -- 5 | render :file => "${filepath}", :use_full_path => ${false} 6 | -------------------------------------------------------------------------------- /ri: -------------------------------------------------------------------------------- 1 | #name : render :inline => " ... " 2 | #group: Rails render 3 | # key: ri 4 | # -- 5 | render :inline => "${<%= 'hello' %>}" 6 | -------------------------------------------------------------------------------- /ril: -------------------------------------------------------------------------------- 1 | #name : render :inline => " ... ", :locals => { ... => " ... " } 2 | #group: Rails render 3 | # key: ril 4 | # -- 5 | render :inline => "${<%= 'hello' %>}", :locals => { ${name} => "${value}" } 6 | -------------------------------------------------------------------------------- /rit: -------------------------------------------------------------------------------- 1 | #name : render :inline => " ... ", :type => : ... ) 2 | #group: Rails render 3 | # key: rit 4 | # -- 5 | render :inline => "${<%= 'hello' %>}", :type => :${rxml}) 6 | -------------------------------------------------------------------------------- /rl: -------------------------------------------------------------------------------- 1 | #name : render :layout => " ... " 2 | #group: Rails render 3 | # key: rl 4 | # -- 5 | render :layout => "${layoutname}" 6 | -------------------------------------------------------------------------------- /rn: -------------------------------------------------------------------------------- 1 | #name : render :nothing => ... 2 | #group: Rails render 3 | # key: rn 4 | # -- 5 | render :nothing => ${true} 6 | -------------------------------------------------------------------------------- /rns: -------------------------------------------------------------------------------- 1 | #name : render :nothing => ... , :status => ... 2 | #group: Rails render 3 | # key: rns 4 | # -- 5 | render :nothing => ${true}, :status => ${401} 6 | -------------------------------------------------------------------------------- /rp: -------------------------------------------------------------------------------- 1 | #name : render :partial => " ... " 2 | #group: Rails render 3 | # key: rp 4 | # -- 5 | render :partial => "${item}" 6 | -------------------------------------------------------------------------------- /rpc: -------------------------------------------------------------------------------- 1 | #name : render :partial => " ... ", :collection => ... 2 | #group: Rails render 3 | # key: rpc 4 | # -- 5 | render :partial => "${item}", :collection => ${items} 6 | -------------------------------------------------------------------------------- /rpl: -------------------------------------------------------------------------------- 1 | #name : render :partial => " ... ", :locals => { : ... => " ... "} 2 | #group: Rails render 3 | # key: rpl 4 | # -- 5 | render :partial => "${item}", :locals => { :${name} => "${value}"} 6 | -------------------------------------------------------------------------------- /rpo: -------------------------------------------------------------------------------- 1 | #name : render :partial => " ... ", :object => ... 2 | #group: Rails render 3 | # key: rpo 4 | # -- 5 | render :partial => "${item}", :object => ${object} 6 | -------------------------------------------------------------------------------- /rps: -------------------------------------------------------------------------------- 1 | #name : render :partial => " ... ", :status => ... 2 | #group: Rails render 3 | # key: rps 4 | # -- 5 | render :partial => "${item}", :status => ${500} 6 | -------------------------------------------------------------------------------- /rreq: -------------------------------------------------------------------------------- 1 | #name : require File.join(File.dirname(__FILE__), ...) 2 | # key: rreq 3 | # -- 4 | require File.join(File.dirname(__FILE__), $0) -------------------------------------------------------------------------------- /rspec-mode/aft: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : after 4 | # key: aft 5 | # -- 6 | after(${1::each}) do 7 | $0 8 | end -------------------------------------------------------------------------------- /rspec-mode/annot: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : any_number_of_times 4 | # key: annot 5 | # -- 6 | any_number_of_times -------------------------------------------------------------------------------- /rspec-mode/anr: -------------------------------------------------------------------------------- 1 | #name: and_return($value) 2 | # key: anr 3 | # -- 4 | and_return(${1:value})$0 -------------------------------------------------------------------------------- /rspec-mode/anra: -------------------------------------------------------------------------------- 1 | #name: and_raise($error) 2 | # key: anra 3 | # -- 4 | and_raise(${1:RuntimeError})$0 -------------------------------------------------------------------------------- /rspec-mode/anrb: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : and_return with block 4 | # key: anrb 5 | # -- 6 | and_return { $1 } -------------------------------------------------------------------------------- /rspec-mode/ant: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : and_throw 4 | # key: ant 5 | # -- 6 | and_throw(${1:sym}) -------------------------------------------------------------------------------- /rspec-mode/any: -------------------------------------------------------------------------------- 1 | #name : any? { |...| ... } 2 | # key: any 3 | # -- 4 | any? { |${e}| $0 } -------------------------------------------------------------------------------- /rspec-mode/atl: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : at_least 4 | # key: atl 5 | # -- 6 | at_least(${1:n}).times -------------------------------------------------------------------------------- /rspec-mode/atm: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : at_most 4 | # key: atm 5 | # -- 6 | at_most(${1:n}).times -------------------------------------------------------------------------------- /rspec-mode/bef: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : before 4 | # key: bef 5 | # -- 6 | before(${1::each}) do 7 | $0 8 | end -------------------------------------------------------------------------------- /rspec-mode/befm: -------------------------------------------------------------------------------- 1 | #name : before (rspec) 2 | # key: befm 3 | # -- 4 | before(:each) do 5 | @${1:model} = ${1:$(replace-regexp-in-string "_" "" (upcase-initials text))}.new$0 6 | end 7 | -------------------------------------------------------------------------------- /rspec-mode/bfe: -------------------------------------------------------------------------------- 1 | #name: before(:each) do ... end 2 | # key: bfe 3 | # -- 4 | before(:each) do 5 | $0 6 | end -------------------------------------------------------------------------------- /rspec-mode/conn: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : controller_name 4 | # key: conn 5 | # -- 6 | controller_name :${1:controller} -------------------------------------------------------------------------------- /rspec-mode/des: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (String) 4 | # key: des 5 | # -- 6 | describe '${1:description}' do 7 | 8 | it 'should ${2:description}' do 9 | $0 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/desc: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (Controller) 4 | # key: desc 5 | # -- 6 | require File.dirname(__FILE__) + '/../spec_helper' 7 | 8 | describe ${1:controller} do 9 | 10 | $0 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/desrc.delete: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (RESTful Controller): DELETE 4 | # key: desrc.delete 5 | # -- 6 | require File.direname(__FILE__) + '/.../spec_helper' 7 | 8 | describe ${1:controller}, 'DELETE ${3:/some/path}${4: with some parameters}' do 9 | 10 | $0 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/desrc.get: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (RESTful Controller): GET 4 | # key: desrc.get 5 | # -- 6 | require File.direname(__FILE__) + '/.../spec_helper' 7 | 8 | describe ${1:controller}, 'GET ${3:/some/path}${4: with some parameters}' do 9 | 10 | $0 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/desrc.post: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (RESTful Controller): POST 4 | # key: desrc.post 5 | # -- 6 | require File.direname(__FILE__) + '/.../spec_helper' 7 | 8 | describe ${1:controller}, 'POST ${3:/some/path}${4: with some parameters}' do 9 | 10 | $0 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/desrc.put: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (RESTful Controller): PUT 4 | # key: desrc.put 5 | # -- 6 | require File.direname(__FILE__) + '/.../spec_helper' 7 | 8 | describe ${1:controller}, 'PUT ${3:/some/path}${4: with some parameters}' do 9 | 10 | $0 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/dest: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (type) 4 | # key: dest 5 | # -- 6 | describe ${1:Type} do 7 | 8 | it 'should ${2:description}' do 9 | $0 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/dests: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : describe (type, string) 4 | # key: dests 5 | # -- 6 | describe ${1:Type}, '${2:description}' do 7 | 8 | it 'should ${3:description}' do 9 | $0 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /rspec-mode/ex: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : exactly 4 | # key: ex 5 | # -- 6 | exactly(${1:n}).times -------------------------------------------------------------------------------- /rspec-mode/fm: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : flexmock mock object w/name 4 | # key: fm 5 | # -- 6 | ${1:var} = flexmock('${2:mock_name}') 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/fmar: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : flexmock mock object, ActiveRecord 4 | # key: fmar 5 | # -- 6 | ${1:var} = flexmock(:model, ${2:YourModel}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/it: -------------------------------------------------------------------------------- 1 | #name: it "should do something" do ... end 2 | # key: it 3 | # -- 4 | it "should ${1:do something}" do 5 | $0 6 | end -------------------------------------------------------------------------------- /rspec-mode/its: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #name : its 3 | # key: its 4 | # -- 5 | its(:${1}) { should $0 } -------------------------------------------------------------------------------- /rspec-mode/mat: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : custom matcher 4 | # key: mat 5 | # -- 6 | class ${1:ReverseTo} 7 | def initialize($3) 8 | @$3 = $3 9 | end 10 | 11 | def matches?(actual) 12 | @actual = actual 13 | # Satisfy expectation here. Return false or raise an error if it's not met. 14 | $0@actual.reverse.should == @$3 15 | true 16 | end 17 | 18 | def failure_message 19 | "expected #{@actual.inspect} to $2 #{@$3.inspect}, but it didn't" 20 | end 21 | 22 | def negative_failure_message 23 | "expected #{@actual.inspect} not to $2 #{@$3.inspect}, but it did" 24 | end 25 | end 26 | 27 | def ${2:reverse_to}(${3:expected}) 28 | $1.new($3) 29 | end -------------------------------------------------------------------------------- /rspec-mode/mocw.flexmock: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : mock_with flexmock 4 | # key: mocw.flexmock 5 | # -- 6 | Spec::Runner.configure do |config| 7 | config.mock_with :flexmock 8 | end -------------------------------------------------------------------------------- /rspec-mode/mocw.mocha: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : mock_with mocha 4 | # key: mocw.mocha 5 | # -- 6 | Spec::Runner.configure do |config| 7 | config.mock_with :mocha 8 | end -------------------------------------------------------------------------------- /rspec-mode/mocw.rr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : mock_with rr 4 | # key: mocw.rr 5 | # -- 6 | Spec::Runner.configure do |config| 7 | config.mock_with :rr 8 | end -------------------------------------------------------------------------------- /rspec-mode/on: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : once 4 | # key: on 5 | # -- 6 | once -------------------------------------------------------------------------------- /rspec-mode/resh: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : Require spec_helper 4 | # key: resh 5 | # -- 6 | require File.dirname(__FILE__) + '/../spec_helper' -------------------------------------------------------------------------------- /rspec-mode/sce: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : Scenario 4 | # key: sce 5 | # -- 6 | Scenario '${1:title}' do 7 | Given '${2:given}' 8 | When '${3:when}' 9 | Then '${4:then}' 10 | end 11 | $0 -------------------------------------------------------------------------------- /rspec-mode/set: -------------------------------------------------------------------------------- 1 | #name: setup do ... end 2 | # key: set 3 | # -- 4 | setup do 5 | $1 6 | end -------------------------------------------------------------------------------- /rspec-mode/sh=: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should == 4 | # key: sh= 5 | # -- 6 | ${1:target}.should == ${2:value} 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shb: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be 4 | # key: shb 5 | # -- 6 | ${1:target}.should be(${2:result}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shbc: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be_close 4 | # key: shbc 5 | # -- 6 | ${1:target}.should be_close(${2:result}, ${3:tolerance}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shbio: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be_instance_of 4 | # key: shbio 5 | # -- 6 | ${1:target}.should be_instance_of(${2:klass}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shbko: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be_kind_of 4 | # key: shbko 5 | # -- 6 | ${1:target}.should be_a_kind_of(${2:klass}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shbr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be_redirect 4 | # key: shbr 5 | # -- 6 | response.should be_redirect 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shbs: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should be_success 4 | # key: shbs 5 | # -- 6 | response.should be_success 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/she.eql: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should eql 4 | # key: she.eql 5 | # -- 6 | ${1:target}.should eql(${2:value}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/she.equal: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should equal 4 | # key: she.equal 5 | # -- 6 | ${1:target}.should equal(${2:value}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shh: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should have 4 | # key: shh 5 | # -- 6 | ${1:target}.should have(${2:num}).${3:things} 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shhal: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should have_at_least 4 | # key: shhal 5 | # -- 6 | ${1:target}.should have_at_least(${2:num}).${3:things} 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shham: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should have_at_most 4 | # key: shham 5 | # -- 6 | ${1:target}.should have_at_most(${2:num}).${3:things} 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shhr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should have_records 4 | # key: shhr 5 | # -- 6 | ${1:target}.should have(${2:x}).records 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shm.match: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should match 4 | # key: shm.match 5 | # -- 6 | ${1:target}.should match(/${2:regex}/) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shn=: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not == 4 | # key: shn= 5 | # -- 6 | ${1:target}.should_not == ${2:value} 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnb: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be 4 | # key: shnb 5 | # -- 6 | ${1:target}.should_not be(${2:result}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnbc: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be_close 4 | # key: shnbc 5 | # -- 6 | ${1:target}.should_not be_close(${2:result}, ${3:tolerance}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnbio: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be_instance_of 4 | # key: shnbio 5 | # -- 6 | ${1:target}.should_not be_instance_of(${2:klass}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnbko: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be_kind_of 4 | # key: shnbko 5 | # -- 6 | ${1:target}.should_not be_a_kind_of(${2:klass}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnbr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be_redirect 4 | # key: shnbr 5 | # -- 6 | response.should_not be_redirect 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnbs: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not be_success 4 | # key: shnbs 5 | # -- 6 | response.should_not be_success 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shne.eql: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not eql 4 | # key: shne.eql 5 | # -- 6 | ${1:target}.should_not eql(${2:value}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shne.equal: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not equal 4 | # key: shne.equal 5 | # -- 6 | ${1:target}.should_not equal(${2:value}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnm.match: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil buffer-read-only: nil -*- 2 | #contributor: gary 3 | #name : should_not match 4 | # key: shnm.match 5 | # -- 6 | ${1:target}.should_not match(/${2:regex}/) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnp: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not predicate 4 | # key: shnp 5 | # -- 6 | ${1:target}.should_not ${2:be_}${3:predicate} $0 -------------------------------------------------------------------------------- /rspec-mode/shnr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not_receive 4 | # key: shnr 5 | # -- 6 | ${1:mock}.should_not_receive(:${2:message})$0 -------------------------------------------------------------------------------- /rspec-mode/shnre: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not raise_error 4 | # key: shnre 5 | # -- 6 | lambda { ${1: } }.should_not raise_error(${2:error}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnrt: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not respond_to 4 | # key: shnrt 5 | # -- 6 | ${1:target}.should_not respond_to(:${2:sym}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shns: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not satisfy 4 | # key: shns 5 | # -- 6 | ${1:target}.should_not satisfy { |obj| ${2: } } 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shnt: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_not throw 4 | # key: shnt 5 | # -- 6 | lambda { ${1: } }.should_not throw_symbol(:${2:symbol}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shp: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should predicate 4 | # key: shp 5 | # -- 6 | ${1:target}.should ${2:be_}${3:predicate} $0 -------------------------------------------------------------------------------- /rspec-mode/shr: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should_receive 4 | # key: shr 5 | # -- 6 | ${1:mock}.should_receive(:${2:message})$0 -------------------------------------------------------------------------------- /rspec-mode/shre: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should raise_error 4 | # key: shre 5 | # -- 6 | lambda { ${1: } }.should raise_error(${2:error}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shrt: -------------------------------------------------------------------------------- 1 | #name: response.should render_template("$template") 2 | # key: shrt 3 | # -- 4 | response.should render_template("${0:template}") -------------------------------------------------------------------------------- /rspec-mode/shrt.redirect: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should redirect_to 4 | # key: shrt.redirect 5 | # -- 6 | response.should redirect_to(${1:url}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shrt.render: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should render_template 4 | # key: shrt.render 5 | # -- 6 | response.should render_template(:${1:template}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shrt.respond: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should respond_to 4 | # key: shrt.respond 5 | # -- 6 | ${1:target}.should respond_to(:${2:sym}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/shs: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should satisfy 4 | # key: shs 5 | # -- 6 | ${1:target}.should satisfy { |obj| ${2: } } 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/sht: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : should throw 4 | # key: sht 5 | # -- 6 | lambda { ${1: } }.should throw_symbol(:${2:symbol}) 7 | $0 -------------------------------------------------------------------------------- /rspec-mode/sto: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : Story 4 | # key: sto 5 | # -- 6 | Story '${1:title}', %{ 7 | As a ${2:role} 8 | I want ${3:feature} 9 | So that ${4:value} 10 | } do 11 | end -------------------------------------------------------------------------------- /rspec-mode/stub: -------------------------------------------------------------------------------- 1 | #name: $target.stub!(:$message) 2 | # key: stub 3 | # -- 4 | ${1:target}.stub!(:${2:message})$0 -------------------------------------------------------------------------------- /rspec-mode/tw: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : twice 4 | # key: tw 5 | # -- 6 | twice -------------------------------------------------------------------------------- /rspec-mode/wia: -------------------------------------------------------------------------------- 1 | #-*- require-final-newline: nil -*- 2 | #contributor: gary 3 | #name : with args 4 | # key: wia 5 | # -- 6 | with(${1:args}) 7 | $0 -------------------------------------------------------------------------------- /rt: -------------------------------------------------------------------------------- 1 | #name : render :text => " ... " 2 | #group: Rails render 3 | # key: rt 4 | # -- 5 | render :text => "${Text here...}" 6 | -------------------------------------------------------------------------------- /rtl: -------------------------------------------------------------------------------- 1 | #name : render :text => " ... ", :layout => " ... " 2 | #group: Rails render 3 | # key: rtl 4 | # -- 5 | render :text => "${Text here...}", :layout => "${layoutname}" 6 | -------------------------------------------------------------------------------- /rtlt: -------------------------------------------------------------------------------- 1 | #name : render :text => " ... ", :layout => ... 2 | #group: Rails render 3 | # key: rtlt 4 | # -- 5 | render :text => "${Text here...}", :layout => ${true} 6 | -------------------------------------------------------------------------------- /rts: -------------------------------------------------------------------------------- 1 | #name : render :text => " ... ", :status => ... 2 | #group: Rails render 3 | # key: rts 4 | # -- 5 | render :text => "${Text here...}", :status => ${401} 6 | -------------------------------------------------------------------------------- /rw: -------------------------------------------------------------------------------- 1 | #name : attr_accessor ... 2 | # key: rw 3 | # -- 4 | attr_accessor : -------------------------------------------------------------------------------- /sca: -------------------------------------------------------------------------------- 1 | #name : scan(/../) { |match| .. } 2 | # key: sca 3 | # -- 4 | scan(/${1:pattern}/) { |${2:match}| $0 } -------------------------------------------------------------------------------- /sel: -------------------------------------------------------------------------------- 1 | #name : select { |e| .. } 2 | #group : Enumerables 3 | # key: sel 4 | # -- 5 | select { |${e}| $0 } -------------------------------------------------------------------------------- /select: -------------------------------------------------------------------------------- 1 | #name : select { |...| ... } 2 | #group : Enumerables 3 | # key: select 4 | # -- 5 | select { |${1:element}| $0 } -------------------------------------------------------------------------------- /ses: -------------------------------------------------------------------------------- 1 | #name : session[: ... ] 2 | #group: Rails 3 | # key: ses 4 | # -- 5 | session[:${user}] 6 | -------------------------------------------------------------------------------- /sinc: -------------------------------------------------------------------------------- 1 | #name : singleton_class() 2 | # key: sinc 3 | # -- 4 | class << self; self end -------------------------------------------------------------------------------- /sor: -------------------------------------------------------------------------------- 1 | #name : sort { |a, b| .. } 2 | #group : Enumerables 3 | # key: sor 4 | # -- 5 | sort { |a, b| $0 } -------------------------------------------------------------------------------- /sorb: -------------------------------------------------------------------------------- 1 | #name : sort_by { |e| .. } 2 | #group : Enumerables 3 | # key: sorb 4 | # -- 5 | sort_by { |${e}| $0 } -------------------------------------------------------------------------------- /sr: -------------------------------------------------------------------------------- 1 | #name : should_receive(:).and_return() 2 | # key: sr 3 | # -- 4 | should_receive(:${1:method}).and_return(${2:return_val}) -------------------------------------------------------------------------------- /ste: -------------------------------------------------------------------------------- 1 | #name : step(2) { |e| .. } 2 | # key: ste 3 | # -- 4 | step(${1:2}) { |${2:n}| $0 } -------------------------------------------------------------------------------- /sub: -------------------------------------------------------------------------------- 1 | #name : sub(/../) { |match| .. } 2 | # key: sub 3 | # -- 4 | sub(/${pattern}/) { |${match}| $0 } -------------------------------------------------------------------------------- /task: -------------------------------------------------------------------------------- 1 | #name : task :name ... end 2 | # key: task 3 | # -- 4 | task :${2:name} do 5 | $0 6 | end -------------------------------------------------------------------------------- /task.1: -------------------------------------------------------------------------------- 1 | #name : desc ... task :name ... end 2 | # key: task.1 3 | # -- 4 | desc "${1:Task description}" 5 | task :${2:name} do 6 | $0 7 | end -------------------------------------------------------------------------------- /tc: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: tc 3 | # -- 4 | require "test/unit" 5 | 6 | require "${1:library_file_name}" 7 | 8 | class Test${2:${1/([\w&&[^_]]+)|./\u$1/g}} < Test::Unit::TestCase 9 | def test_${3:case_name} 10 | $0 11 | end 12 | end -------------------------------------------------------------------------------- /tim: -------------------------------------------------------------------------------- 1 | #name : times { |n| ... } 2 | # key: tim 3 | # -- 4 | times { |${n}| $0 } -------------------------------------------------------------------------------- /tra: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: tra 3 | # -- 4 | transaction${1/(^.*?\S.*)|.*/(?1:\()/}${1:true}${1/(^.*?\S.*)|.*/(?1:\))/} { $0 } -------------------------------------------------------------------------------- /ts: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: ts 3 | # -- 4 | require "test/unit" 5 | 6 | require "tc_${1:test_case_file}" 7 | require "tc_${2:test_case_file}" 8 | -------------------------------------------------------------------------------- /unif: -------------------------------------------------------------------------------- 1 | #name : unix_filter { .. } 2 | # key: unif 3 | # -- 4 | ARGF.each_line$1 do |${2:line}| 5 | $0 6 | end -------------------------------------------------------------------------------- /unless: -------------------------------------------------------------------------------- 1 | # -*- mode: yasnippet -*- 2 | #name : unless ... end 3 | #group : Conditions 4 | # key: unless 5 | # -- 6 | unless ${1:condition} 7 | $0 8 | end -------------------------------------------------------------------------------- /until: -------------------------------------------------------------------------------- 1 | #name : until ... end 2 | # key: until 3 | # -- 4 | until ${1:condition} 5 | $0 6 | end -------------------------------------------------------------------------------- /upt: -------------------------------------------------------------------------------- 1 | #name : upto(1.0/0.0) { |n| .. } 2 | # key: upt 3 | # -- 4 | upto(${1:1.0/0.0}) { |${2:n}| $0 } -------------------------------------------------------------------------------- /usai: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: usai 3 | # -- 4 | if ARGV.$1 5 | abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}" 6 | end -------------------------------------------------------------------------------- /usau: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: usau 3 | # -- 4 | unless ARGV.$1 5 | abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}" 6 | end -------------------------------------------------------------------------------- /va: -------------------------------------------------------------------------------- 1 | #name : validates_associated : ... 2 | #group: ActiveRecord 3 | # key: va 4 | # -- 5 | validates_associated :${attr} 6 | -------------------------------------------------------------------------------- /vc: -------------------------------------------------------------------------------- 1 | #name : validates_confirmation_of : ... 2 | #group: ActiveRecord 3 | # key: vc 4 | # -- 5 | validates_confirmation_of :${attr} 6 | -------------------------------------------------------------------------------- /ve: -------------------------------------------------------------------------------- 1 | #name : validates_exclusion_of : ... 2 | #group: ActiveRecord 3 | # key: ve 4 | # -- 5 | validates_exclusion_of :${attr} 6 | -------------------------------------------------------------------------------- /vf: -------------------------------------------------------------------------------- 1 | #name : validates_format_of : ... , :with => / ... / 2 | #group: ActiveRecord 3 | # key: vf 4 | # -- 5 | validates_format_of :${attr}, :with => /${regex}/ 6 | -------------------------------------------------------------------------------- /vi: -------------------------------------------------------------------------------- 1 | #name : validates_inclusion_of : ... 2 | #group: ActiveRecord 3 | # key: vi 4 | # -- 5 | validates_inclusion_of :${attr} -------------------------------------------------------------------------------- /vn: -------------------------------------------------------------------------------- 1 | #name : validates_numericality_of : ... 2 | #group: ActiveRecord 3 | # key: vn 4 | # -- 5 | validates_numericality_of :${attr} 6 | -------------------------------------------------------------------------------- /vp: -------------------------------------------------------------------------------- 1 | #name : validates_presence_of : ... 2 | #group: ActiveRecord 3 | # key: vp 4 | # -- 5 | validates_presence_of :${attr} -------------------------------------------------------------------------------- /vu: -------------------------------------------------------------------------------- 1 | #name : validates_uniqueness_of : ... 2 | #group: ActiveRecord 3 | # key: vu 4 | # -- 5 | validates_uniqueness_of :${attr} 6 | -------------------------------------------------------------------------------- /w: -------------------------------------------------------------------------------- 1 | #name : attr_writer ... 2 | # key: w 3 | # -- 4 | attr_writer : -------------------------------------------------------------------------------- /when: -------------------------------------------------------------------------------- 1 | #name : when ... 2 | #group : Conditions 3 | # key: when 4 | # -- 5 | when ${1:condition} 6 | $0 -------------------------------------------------------------------------------- /while: -------------------------------------------------------------------------------- 1 | #name : while ... end 2 | #group : Loops 3 | # key: while 4 | # -- 5 | while ${condition} 6 | $0 7 | end -------------------------------------------------------------------------------- /xml-: -------------------------------------------------------------------------------- 1 | # This was cloned from a TextMate bundle for yasnippet. 2 | # key: xml- 3 | # -- 4 | REXML::Document.new(File.read(${1:"${2:path/to/file}"})) -------------------------------------------------------------------------------- /xpa: -------------------------------------------------------------------------------- 1 | #name : xpath(..) { .. } 2 | # key: xpa 3 | # -- 4 | elements.each("${1://XPath}") do |${2:node}| 5 | $0 6 | end -------------------------------------------------------------------------------- /y: -------------------------------------------------------------------------------- 1 | #name : :yields: arguments (rdoc) 2 | # key: y 3 | # -- 4 | :yields: $0 -------------------------------------------------------------------------------- /zip: -------------------------------------------------------------------------------- 1 | #name : zip(...) { |...| ... } 2 | #group : Enumerables 3 | # key: zip 4 | # -- 5 | zip(${enums}) { |${row}| $0 } -------------------------------------------------------------------------------- /{: -------------------------------------------------------------------------------- 1 | #name : { |variable| ... } 2 | #group : Blocks 3 | # key: { 4 | # -- 5 | { |${1:variable}| $0 } --------------------------------------------------------------------------------