yasnippet/extras/imported/ruby-mode/Classes and Modules/class .. instance_methods .. undef .. initialize .. end (class).yasnippet
2009-08-29 17:59:02 +00:00

20 lines
463 B
Plaintext

# -*- mode: snippet -*-
# key: cla
# contributor: Translated from TextMate Snippet
# name: class BlankSlate .. initialize .. end
# --
class ${1:BlankSlate}
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/}
@${3:delegate} = ${4:delegate_object}
$0
end
def method_missing(meth, *args, &block)
@${3:delegate}.send(meth, *args, &block)
end
end