more ruby snippets

This commit is contained in:
Zhang Chiyuan 2008-03-06 15:01:27 +00:00
parent c45eff49e2
commit f1e3d81609
26 changed files with 92 additions and 0 deletions

3
snippets/ruby-mode/=b Normal file
View File

@ -0,0 +1,3 @@
=begin rdoc
$0
=end

7
snippets/ruby-mode/Comp Normal file
View File

@ -0,0 +1,7 @@
#name : include Comparable; def <=> ... end
# --
include Comparable
def <=> other
$0
end

3
snippets/ruby-mode/all Normal file
View File

@ -0,0 +1,3 @@
#name : all? { |...| ... }
# --
all? { |${e}| $0 }

3
snippets/ruby-mode/any Normal file
View File

@ -0,0 +1,3 @@
#name : any? { |...| ... }
# --
any? { |${e}| $0 }

5
snippets/ruby-mode/app Normal file
View File

@ -0,0 +1,5 @@
#name : if __FILE__ == $PROGRAM_NAME ... end
# --
if __FILE__ == $PROGRAM_NAME
$0
end

5
snippets/ruby-mode/bm Normal file
View File

@ -0,0 +1,5 @@
#name : Benchmark.bmbm(...) do ... end
# --
Benchmark.bmbm(${1:10}) do |x|
$0
end

5
snippets/ruby-mode/cla Normal file
View File

@ -0,0 +1,5 @@
#name : class << self ... end
# --
class << ${self}
$0
end

View File

@ -0,0 +1,3 @@
#name : classify { |...| ... }
# --
classify { |${e}| $0 }

5
snippets/ruby-mode/cls Normal file
View File

@ -0,0 +1,5 @@
#name : class ... end
# --
class ${Name}
$0
end

View File

@ -0,0 +1,3 @@
#name : collect { |...| ... }
# --
collect { |${e}| $0 }

3
snippets/ruby-mode/dee Normal file
View File

@ -0,0 +1,3 @@
#name : deep_copy(...)
# --
Marshal.load(Marshal.dump($0))

3
snippets/ruby-mode/deli Normal file
View File

@ -0,0 +1,3 @@
#name : delete_if { |...| ... }
# --
delete_if { |${e} $0 }

3
snippets/ruby-mode/det Normal file
View File

@ -0,0 +1,3 @@
#name : detect { |...| ... }
# --
detect { |${e}| $0 }

3
snippets/ruby-mode/ea Normal file
View File

@ -0,0 +1,3 @@
#name : each { |...| ... }
# --
each { |${e}| $0 }

3
snippets/ruby-mode/eac Normal file
View File

@ -0,0 +1,3 @@
#name : each_cons(...) { |...| ... }
# --
each_cons(${1:2}) { |${group}| $0 }

3
snippets/ruby-mode/eai Normal file
View File

@ -0,0 +1,3 @@
#name : each_index { |i| ... }
# --
each_index { |${i}| $0 }

3
snippets/ruby-mode/eav Normal file
View File

@ -0,0 +1,3 @@
#name : each_value { |val| ... }
# --
each_value { |${val}| $0 }

3
snippets/ruby-mode/eawi Normal file
View File

@ -0,0 +1,3 @@
#name : each_with_index { |e, i| ... }
# --
each_with_index { |${e}, ${i}| $0 }

5
snippets/ruby-mode/mm Normal file
View File

@ -0,0 +1,5 @@
#name : def method_missing ... end
# --
def method_missing(method, *args)
$0
end

3
snippets/ruby-mode/r Normal file
View File

@ -0,0 +1,3 @@
#name : attr_reader ...
# --
attr_reader :${attr_names}

3
snippets/ruby-mode/req Normal file
View File

@ -0,0 +1,3 @@
#name : require "..."
# --
require "$0"

3
snippets/ruby-mode/rreq Normal file
View File

@ -0,0 +1,3 @@
#name : require File.join(File.dirname(__FILE__), ...)
# --
require File.join(File.dirname(__FILE__), $0)

3
snippets/ruby-mode/rw Normal file
View File

@ -0,0 +1,3 @@
#name : attr_accessor ...
# --
attr_accessor :{attr_names}

3
snippets/ruby-mode/w Normal file
View File

@ -0,0 +1,3 @@
#name : attr_writer ...
# --
attr_writer :${attr_names}

3
snippets/ruby-mode/y Normal file
View File

@ -0,0 +1,3 @@
#name : :yields: arguments (rdoc)
# --
:yields: $0

3
snippets/ruby-mode/zip Normal file
View File

@ -0,0 +1,3 @@
#name : zip(...) { |...| ... }
# --
zip(${enums}) { |${row}| $0 }