# File lib/clipboard.rb, line 78 78: def self.clear 79: copy '' 80: end
# File lib/clipboard.rb, line 42 42: def self.clear 43: @open[0] 44: @empty[] 45: @close[] 46: paste 47: end
# File lib/clipboard.rb, line 83 83: def self.copy(data) 84: WriteCommands.each{ |cmd| 85: IO.popen( cmd, 'w' ){ |input| input << data } 86: } 87: paste 88: end
# File lib/clipboard.rb, line 69 69: def self.paste(which = nil) 70: selection_string = if Clipboards.include?(which.to_s) 71: " -selection #{which}" 72: else 73: '' 74: end 75: %[#{ ReadCommand + selection_string }] 76: end
paste & clear inspired by segment7.net and www.codeproject.com/KB/clipboard/archerclipboard1.aspx does not work on 1.9, has probably something to do with utf8 strings ?
# File lib/clipboard.rb, line 28 28: def self.paste(_=nil) 29: data = "" 30: if 0 != @open[ 0 ] 31: hclip = @get[ CF_TEXT ] 32: if 0 != hclip 33: if 0 != data = @lock[ hclip ] 34: @unlock[ hclip ] 35: end 36: end 37: @close[] 38: end 39: data || "" 40: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.