summaryrefslogtreecommitdiffstats
path: root/emacs.d/lisp/yasnippet/snippets/ruby-mode
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-make-groups0
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-parents1
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/all3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/any3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/classify3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/collect3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/deli3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/det3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/ea3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eac3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eai3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eav3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eawi3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/inject3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/reject3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/select3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/zip3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/forin5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/if5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/ife7
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/tim3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/until5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/upt5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/when5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/while5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/Comp7
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/am3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cla5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cls12
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/mm5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/r3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/rw3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/w3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/#3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/=b5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/app5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/bm5
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/case6
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/dee3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rb3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/req3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rreq3
-rw-r--r--emacs.d/lisp/yasnippet/snippets/ruby-mode/general/y3
43 files changed, 166 insertions, 0 deletions
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-make-groups b/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-make-groups
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-make-groups
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-parents b/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-parents
new file mode 100644
index 0000000..eed5b44
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/.yas-parents
@@ -0,0 +1 @@
+text-mode
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/all b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/all
new file mode 100644
index 0000000..afb68a7
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/all
@@ -0,0 +1,3 @@
+#name : all? { |...| ... }
+# --
+all? { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/any b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/any
new file mode 100644
index 0000000..2f4f9f1
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/any
@@ -0,0 +1,3 @@
+#name : any? { |...| ... }
+# --
+any? { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/classify b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/classify
new file mode 100644
index 0000000..d1ad6f3
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/classify
@@ -0,0 +1,3 @@
+#name : classify { |...| ... }
+# --
+classify { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/collect b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/collect
new file mode 100644
index 0000000..37cd4b5
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/collect
@@ -0,0 +1,3 @@
+#name : collect { |...| ... }
+# --
+collect { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/deli b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/deli
new file mode 100644
index 0000000..f51d9a6
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/deli
@@ -0,0 +1,3 @@
+#name : delete_if { |...| ... }
+# --
+delete_if { |${e} $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/det b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/det
new file mode 100644
index 0000000..599898c
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/det
@@ -0,0 +1,3 @@
+#name : detect { |...| ... }
+# --
+detect { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/ea b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/ea
new file mode 100644
index 0000000..40cb2cd
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/ea
@@ -0,0 +1,3 @@
+#name : each { |...| ... }
+# --
+each { |${e}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eac b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eac
new file mode 100644
index 0000000..7a7ccd4
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eac
@@ -0,0 +1,3 @@
+#name : each_cons(...) { |...| ... }
+# --
+each_cons(${1:2}) { |${group}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eai b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eai
new file mode 100644
index 0000000..b68cf69
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eai
@@ -0,0 +1,3 @@
+#name : each_index { |i| ... }
+# --
+each_index { |${i}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eav b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eav
new file mode 100644
index 0000000..189ceff
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eav
@@ -0,0 +1,3 @@
+#name : each_value { |val| ... }
+# --
+each_value { |${val}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eawi b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eawi
new file mode 100644
index 0000000..8718f7a
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/eawi
@@ -0,0 +1,3 @@
+#name : each_with_index { |e, i| ... }
+# --
+each_with_index { |${e}, ${i}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/inject b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/inject
new file mode 100644
index 0000000..eaa0f28
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/inject
@@ -0,0 +1,3 @@
+#name : inject(...) { |...| ... }
+# --
+inject(${1:0}) { |${2:injection}, ${3:element}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/reject b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/reject
new file mode 100644
index 0000000..032b06d
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/reject
@@ -0,0 +1,3 @@
+#name : reject { |...| ... }
+# --
+reject { |${1:element}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/select b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/select
new file mode 100644
index 0000000..5ea4ef8
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/select
@@ -0,0 +1,3 @@
+#name : select { |...| ... }
+# --
+select { |${1:element}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/zip b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/zip
new file mode 100644
index 0000000..910de64
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/collections/zip
@@ -0,0 +1,3 @@
+#name : zip(...) { |...| ... }
+# --
+zip(${enums}) { |${row}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/forin b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/forin
new file mode 100644
index 0000000..197e09e
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/forin
@@ -0,0 +1,5 @@
+#name : for ... in ...; ... end
+# --
+for ${1:element} in ${2:collection}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/if b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/if
new file mode 100644
index 0000000..c96069b
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/if
@@ -0,0 +1,5 @@
+#name : if ... end
+# --
+if ${1:condition}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/ife b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/ife
new file mode 100644
index 0000000..959d77c
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/ife
@@ -0,0 +1,7 @@
+#name : if ... else ... end
+# --
+if ${1:condition}
+ $2
+else
+ $3
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/tim b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/tim
new file mode 100644
index 0000000..44023c0
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/tim
@@ -0,0 +1,3 @@
+#name : times { |n| ... }
+# --
+times { |${n}| $0 }
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/until b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/until
new file mode 100644
index 0000000..b3534a8
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/until
@@ -0,0 +1,5 @@
+#name : until ... end
+# --
+until ${condition}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/upt b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/upt
new file mode 100644
index 0000000..73c0046
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/upt
@@ -0,0 +1,5 @@
+#name : upto(...) { |n| ... }
+# --
+upto(${n}) { |${i}|
+ $0
+}
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/when b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/when
new file mode 100644
index 0000000..51f63a3
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/when
@@ -0,0 +1,5 @@
+#name : when ... end
+# --
+when ${condition}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/while b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/while
new file mode 100644
index 0000000..00e114f
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/control structure/while
@@ -0,0 +1,5 @@
+#name : while ... end
+# --
+while ${condition}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/Comp b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/Comp
new file mode 100644
index 0000000..7afea97
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/Comp
@@ -0,0 +1,7 @@
+#name : include Comparable; def <=> ... end
+# --
+include Comparable
+
+def <=> other
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/am b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/am
new file mode 100644
index 0000000..68ceff0
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/am
@@ -0,0 +1,3 @@
+#name : alias_method new, old
+# --
+alias_method :${new_name}, :${old_name}
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cla b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cla
new file mode 100644
index 0000000..da71b10
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cla
@@ -0,0 +1,5 @@
+#name : class << self ... end
+# --
+class << ${self}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cls b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cls
new file mode 100644
index 0000000..64ef27e
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/cls
@@ -0,0 +1,12 @@
+#name : class ... end
+#contributor : hitesh <hitesh.jasani@gmail.com>
+# --
+class ${1:`(let ((fn (capitalize (file-name-nondirectory
+ (file-name-sans-extension
+ (or (buffer-file-name)
+ (buffer-name (current-buffer))))))))
+ (cond
+ ((string-match "_" fn) (replace-match "" nil nil fn))
+ (t fn)))`}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/mm b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/mm
new file mode 100644
index 0000000..7b348d7
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/mm
@@ -0,0 +1,5 @@
+#name : def method_missing ... end
+# --
+def method_missing(method, *args)
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/r b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/r
new file mode 100644
index 0000000..b933a13
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/r
@@ -0,0 +1,3 @@
+#name : attr_reader ...
+# --
+attr_reader :
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/rw b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/rw
new file mode 100644
index 0000000..7153541
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/rw
@@ -0,0 +1,3 @@
+#name : attr_accessor ...
+# --
+attr_accessor :
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/w b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/w
new file mode 100644
index 0000000..cd6d473
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/definitions/w
@@ -0,0 +1,3 @@
+#name : attr_writer ...
+# --
+attr_writer :
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/# b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/#
new file mode 100644
index 0000000..b9e3f8a
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/#
@@ -0,0 +1,3 @@
+#name : # =>
+# --
+# =>
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/=b b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/=b
new file mode 100644
index 0000000..e396723
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/=b
@@ -0,0 +1,5 @@
+#name : =begin rdoc ... =end
+# --
+=begin rdoc
+ $0
+=end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/app b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/app
new file mode 100644
index 0000000..b151ccc
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/app
@@ -0,0 +1,5 @@
+#name : if __FILE__ == $PROGRAM_NAME ... end
+# --
+if __FILE__ == $PROGRAM_NAME
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/bm b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/bm
new file mode 100644
index 0000000..44fb2b6
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/bm
@@ -0,0 +1,5 @@
+#name : Benchmark.bmbm(...) do ... end
+# --
+Benchmark.bmbm(${1:10}) do |x|
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/case b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/case
new file mode 100644
index 0000000..b919081
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/case
@@ -0,0 +1,6 @@
+#name : case ... end
+# --
+case ${1:object}
+when ${2:condition}
+ $0
+end
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/dee b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/dee
new file mode 100644
index 0000000..496e187
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/dee
@@ -0,0 +1,3 @@
+#name : deep_copy(...)
+# --
+Marshal.load(Marshal.dump($0))
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rb b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rb
new file mode 100644
index 0000000..9153653
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rb
@@ -0,0 +1,3 @@
+#name : /usr/bin/ruby -wKU
+# --
+#!/usr/bin/ruby -wKU
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/req b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/req
new file mode 100644
index 0000000..3ada7d5
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/req
@@ -0,0 +1,3 @@
+#name : require "..."
+# --
+require "$0"
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rreq b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rreq
new file mode 100644
index 0000000..ff80c71
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/rreq
@@ -0,0 +1,3 @@
+#name : require File.join(File.dirname(__FILE__), ...)
+# --
+require File.join(File.dirname(__FILE__), $0)
diff --git a/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/y b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/y
new file mode 100644
index 0000000..a57fbde
--- /dev/null
+++ b/emacs.d/lisp/yasnippet/snippets/ruby-mode/general/y
@@ -0,0 +1,3 @@
+#name : :yields: arguments (rdoc)
+# --
+:yields: $0