about summary refs log tree commit diff stats
path: root/code/runcontext.rb
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-06-13 02:33:35 +0200
committerhut <hut@lavabit.com>2009-06-13 02:33:35 +0200
commit46ad9bb591d057715fcd63376326336f3339fba7 (patch)
tree017800b49d26f5454a19469fbadd72f677883cb2 /code/runcontext.rb
parent2887ca25fb58362d5d644ecda5f0bc51c80ec404 (diff)
downloadranger-46ad9bb591d057715fcd63376326336f3339fba7.tar.gz
cleaning up
Diffstat (limited to 'code/runcontext.rb')
-rw-r--r--code/runcontext.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/code/runcontext.rb b/code/runcontext.rb
index 3d9ff457..1e10aa8d 100644
--- a/code/runcontext.rb
+++ b/code/runcontext.rb
@@ -114,13 +114,26 @@ class RunContext
 	##   rc.paths.map {|x| ~x}.join(' ')
 	## otherwise:
 	##   ~(rc.paths.first)
-	def ~() @paths.map {|x| ~x}.join(' ') end
+	def ~
+		if @multi
+			@paths.map {|x| ~x}.join(' ')
+		else
+			~@paths.first
+		end
+	end
+
+	## escape one (the first) file for direct use in the shell.
+	## this is a shortcut for:
+	##   ~(rc.paths.first)
+	def one
+		~@paths.first
+	end
 
 	## shortcut for _files.size_
 	def size() @files.size end
 
 	## shortcut for _files.first.path_
-	def first() @files.first.path end
+	def first() @files.first end
 
 	## shortcut for _files.first.name_
 	def name() @files.first.name end