Files ruby-mode snippets updated to work with yasnippet.

This commit is contained in:
Rob Christie 2009-11-02 01:34:29 +00:00
parent 02408621e8
commit 32c837290d
4 changed files with 3 additions and 13 deletions

View File

@ -4,4 +4,4 @@
# name: File.open("..") { |file| .. }
## condition: "source.ruby"
# --
File.open(${1:"${2:path/to/file}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:file}| $0 }
File.open(${1:"${2:path/to/file}"}${3:$(if (string-match "^[rwab+]+$" yas/text) ", '" "")}${3:w}${3:$(if (string-match "^[rwab+]+$" yas/text) "'" "")}) { |${4:file}| $0 }

View File

@ -4,4 +4,4 @@
# name: open("path/or/url", "w") { |io| .. }
## condition: "source.ruby"
# --
open(${1:"${2:path/or/url/or/pipe}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:io}| $0 }
open(${1:"${2:path/or/url/or/pipe}"}${3:$(if (string-match "^[rwab+]+$" yas/text) ", '" "")}${3:w}${3:$(if (string-match "^[rwab+]+$" yas/text) "'" "")}) { |${4:io}| $0 }

View File

@ -9,7 +9,7 @@ require "optparse"
options = {${1::default => "args"}}
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2/^\s*$|(.*\S.*)/(?1: )/}${2:OTHER_ARGS}"
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2:$(if (string= yas/text "") "" " ")}${2:OTHER_ARGS}"
opts.separator ""
opts.separator "Specific Options:"

View File

@ -1,10 +0,0 @@
# -*- mode: snippet -*-
# key: opt
# contributor: Translated from TextMate Snippet
# name: option(..)
## condition: "source.ruby"
# --
opts.on( "-${1:o}", "--${2:long-option-name}"${3/^\s*$|(.*\S.*)/(?1:, )/}${3:String},
"${4:Option description.}" ) do |${6:opt}|
$0
end