mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-05-05 23:28:19 +00:00
more ruby snippets
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
=begin rdoc
|
||||||
|
$0
|
||||||
|
=end
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#name : include Comparable; def <=> ... end
|
||||||
|
# --
|
||||||
|
include Comparable
|
||||||
|
|
||||||
|
def <=> other
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : all? { |...| ... }
|
||||||
|
# --
|
||||||
|
all? { |${e}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : any? { |...| ... }
|
||||||
|
# --
|
||||||
|
any? { |${e}| $0 }
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : if __FILE__ == $PROGRAM_NAME ... end
|
||||||
|
# --
|
||||||
|
if __FILE__ == $PROGRAM_NAME
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : Benchmark.bmbm(...) do ... end
|
||||||
|
# --
|
||||||
|
Benchmark.bmbm(${1:10}) do |x|
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : class << self ... end
|
||||||
|
# --
|
||||||
|
class << ${self}
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : classify { |...| ... }
|
||||||
|
# --
|
||||||
|
classify { |${e}| $0 }
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : class ... end
|
||||||
|
# --
|
||||||
|
class ${Name}
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : collect { |...| ... }
|
||||||
|
# --
|
||||||
|
collect { |${e}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : deep_copy(...)
|
||||||
|
# --
|
||||||
|
Marshal.load(Marshal.dump($0))
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : delete_if { |...| ... }
|
||||||
|
# --
|
||||||
|
delete_if { |${e} $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : detect { |...| ... }
|
||||||
|
# --
|
||||||
|
detect { |${e}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : each { |...| ... }
|
||||||
|
# --
|
||||||
|
each { |${e}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : each_cons(...) { |...| ... }
|
||||||
|
# --
|
||||||
|
each_cons(${1:2}) { |${group}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : each_index { |i| ... }
|
||||||
|
# --
|
||||||
|
each_index { |${i}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : each_value { |val| ... }
|
||||||
|
# --
|
||||||
|
each_value { |${val}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : each_with_index { |e, i| ... }
|
||||||
|
# --
|
||||||
|
each_with_index { |${e}, ${i}| $0 }
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : def method_missing ... end
|
||||||
|
# --
|
||||||
|
def method_missing(method, *args)
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : attr_reader ...
|
||||||
|
# --
|
||||||
|
attr_reader :${attr_names}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : require "..."
|
||||||
|
# --
|
||||||
|
require "$0"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : require File.join(File.dirname(__FILE__), ...)
|
||||||
|
# --
|
||||||
|
require File.join(File.dirname(__FILE__), $0)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : attr_accessor ...
|
||||||
|
# --
|
||||||
|
attr_accessor :{attr_names}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : attr_writer ...
|
||||||
|
# --
|
||||||
|
attr_writer :${attr_names}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : :yields: arguments (rdoc)
|
||||||
|
# --
|
||||||
|
:yields: $0
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : zip(...) { |...| ... }
|
||||||
|
# --
|
||||||
|
zip(${enums}) { |${row}| $0 }
|
||||||
Reference in New Issue
Block a user