From 32c837290df7a34d92ec82a81a21a69e5859b780 Mon Sep 17 00:00:00 2001 From: Rob Christie Date: Mon, 2 Nov 2009 01:34:29 +0000 Subject: [PATCH] Files ruby-mode snippets updated to work with yasnippet. --- .../Files/File_open(__) { file __ }.yasnippet | 2 +- .../open(pathorurl, w) do doc .. end (ope).yasnippet | 2 +- .../Files/option_parse { .. } (optp).yasnippet | 2 +- extras/imported/ruby-mode/Files/untitled.yasnippet | 10 ---------- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 extras/imported/ruby-mode/Files/untitled.yasnippet diff --git a/extras/imported/ruby-mode/Files/File_open(__) { file __ }.yasnippet b/extras/imported/ruby-mode/Files/File_open(__) { file __ }.yasnippet index e50777f..75aaa3a 100644 --- a/extras/imported/ruby-mode/Files/File_open(__) { file __ }.yasnippet +++ b/extras/imported/ruby-mode/Files/File_open(__) { file __ }.yasnippet @@ -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 } \ No newline at end of file +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 } \ No newline at end of file diff --git a/extras/imported/ruby-mode/Files/open(pathorurl, w) do doc .. end (ope).yasnippet b/extras/imported/ruby-mode/Files/open(pathorurl, w) do doc .. end (ope).yasnippet index ab36385..0d2631b 100644 --- a/extras/imported/ruby-mode/Files/open(pathorurl, w) do doc .. end (ope).yasnippet +++ b/extras/imported/ruby-mode/Files/open(pathorurl, w) do doc .. end (ope).yasnippet @@ -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 } \ No newline at end of file +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 } \ No newline at end of file diff --git a/extras/imported/ruby-mode/Files/option_parse { .. } (optp).yasnippet b/extras/imported/ruby-mode/Files/option_parse { .. } (optp).yasnippet index 18ccabd..4880218 100644 --- a/extras/imported/ruby-mode/Files/option_parse { .. } (optp).yasnippet +++ b/extras/imported/ruby-mode/Files/option_parse { .. } (optp).yasnippet @@ -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:" diff --git a/extras/imported/ruby-mode/Files/untitled.yasnippet b/extras/imported/ruby-mode/Files/untitled.yasnippet deleted file mode 100644 index 82db65c..0000000 --- a/extras/imported/ruby-mode/Files/untitled.yasnippet +++ /dev/null @@ -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 \ No newline at end of file