lib/rio/prompt.rb in rio-0.4.1 vs lib/rio/prompt.rb in rio-0.4.2
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===============================================================================
-# Copyright (c) 2005,2006,2007 Christopher Kleckner
+# Copyright (c) 2005,2006,2007,2008 Christopher Kleckner
# All rights reserved
#
# This file is part of the Rio library for ruby.
#
# Rio is free software; you can redistribute it and/or modify
@@ -45,10 +45,14 @@
dstr = default ? "[#{default}]: " : ": "
pstr = str + dstr
ans = prompt(pstr)
ans.empty? ? default : ans
end
- module_function :prompt,:promptd
+ def promptr(str="",default=nil)
+ ans = promptd(str,default)
+ rio(ans)
+ end
+ module_function :prompt,:promptd,:promptr
end
if $0 == __FILE__
eval DATA.read, nil, $0, __LINE__+4
end