PageRenderTime 192ms CodeModel.GetById 91ms app.highlight 1ms RepoModel.GetById 99ms app.codeStats 0ms

/ruby-mode/Classes and Modules/class .. instance_methods .. undef .. initialize .. end (class).yasnippet

http://github.com/ridgetang/snippets
Unknown | 20 lines | 15 code | 5 blank | 0 comment | 0 complexity | 3909f3b2d7e0a1acfdf7dffc4a403b6b MD5 | raw file
 1# -*- mode: snippet -*-
 2# key: cla
 3# contributor: Translated from TextMate Snippet
 4# name: class BlankSlate .. initialize .. end
 5# --
 6class ${1:BlankSlate}
 7	instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
 8	
 9	def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/}
10		@${3:delegate} = ${4:delegate_object}
11		
12		$0
13	end
14	
15	def method_missing(meth, *args, &block)
16		@${3:delegate}.send(meth, *args, &block)
17	end
18	
19	
20end