mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-15 01:44:19 +00:00
Last commit before tagging and releasing
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. < DelegateClass .. initialize .. end
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < DelegateClass(${2:ParentClass})
|
||||
def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/}
|
||||
super(${4:del_obj})
|
||||
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. < ParentClass .. initialize .. end
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < ${2:ParentClass}
|
||||
def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ClassName = Struct .. do .. end
|
||||
# --
|
||||
${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} = Struct.new(:${2:attr_names}) do
|
||||
def ${3:method_name}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. end
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
$0
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. initialize .. end
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- 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
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class << self .. end
|
||||
# --
|
||||
class << ${1:self}
|
||||
$0
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. ClassMethods .. end
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
module ClassMethods
|
||||
$0
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
|
||||
end
|
||||
|
||||
def self.included(receiver)
|
||||
receiver.extend ClassMethods
|
||||
receiver.send :include, InstanceMethods
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. end
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
$0
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. module_function .. end
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
module_function
|
||||
|
||||
$0
|
||||
end
|
||||
Reference in New Issue
Block a user