Add ruby stuff
[emacs.git] / .emacs.d / elisp / yasnippet / snippets / python-mode / class
1 # -*- coding: utf-8 -*-
2 # name: class
3 # contributor: Orestis Markou
4 # contributor: Nishio Hirokazu
5 # contributor: Yasser González Fernández <yglez@uh.cu>
6 # key: class
7 # --
8 class ${1:ClassName}(${2:object}):
9 """$3
10 """
11
12 def __init__(self, $4):
13 """$5
14 ${4:$
15 (let* ((indent
16 (concat "\n" (make-string (current-column) 32)))
17 (args
18 (mapconcat
19 '(lambda (x)
20 (if (not (string= (nth 0 x) ""))
21 (concat "- " (char-to-string 96) (nth 0 x)
22 (char-to-string 96) ":")))
23 (mapcar
24 '(lambda (x)
25 (mapcar
26 (lambda (x)
27 (replace-regexp-in-string "[[:blank:]]*$" ""
28 (replace-regexp-in-string "^[[:blank:]]*" "" x))) x))
29 (mapcar '(lambda (x) (split-string x "="))
30 (split-string text ",")))
31 indent)))
32 (if (string= args "")
33 (make-string 3 34)
34 (mapconcat
35 'identity
36 (list "" "Arguments:" args (make-string 3 34))
37 indent)))
38 }
39 ${4:$
40 (mapconcat
41 '(lambda (x)
42 (if (not (string= (nth 0 x) ""))
43 (concat "self._" (nth 0 x) " = " (nth 0 x))))
44 (mapcar
45 '(lambda (x)
46 (mapcar
47 '(lambda (x)
48 (replace-regexp-in-string "[[:blank:]]*$" ""
49 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
50 x))
51 (mapcar '(lambda (x) (split-string x "="))
52 (split-string text ",")))
53 (concat "\n" (make-string (current-column) 32)))
54 }
55 $0