# File lib/clipboard.rb, line 82 82: def self.clear 83: copy '' 84: end
# File lib/clipboard.rb, line 42 42: def self.clear 43: @open[0] 44: @empty[] 45: @close[] 46: paste 47: end
copy for all platforms
# File lib/clipboard.rb, line 88 88: def self.copy(data) 89: WriteCommands.each{ |cmd| 90: IO.popen( cmd, 'w' ){ |input| input << data } 91: } 92: paste 93: end
# File lib/clipboard.rb, line 73 73: def self.paste(which = nil) 74: selection_string = if Clipboards.include?(which.to_s) 75: " -selection #{which}" 76: else 77: '' 78: end 79: %[#{ ReadCommand + selection_string }] 80: 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.