[ruby] Allow pbcopy to take a block

pull/28/head
Alpha Chen 10 years ago
parent 3a808413ae
commit 7b67451bad

@ -15,7 +15,8 @@ begin
rescue LoadError rescue LoadError
end end
def pbcopy(str) def pbcopy(str=nil)
str = yield if block_given?
IO.popen(%w[pbcopy], 'w') {|io| io.write str } IO.popen(%w[pbcopy], 'w') {|io| io.write str }
end end

Loading…
Cancel
Save