# File lib/clipboard.rb, line 83 83: def self.clear 84: copy '' 85: 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 89 89: def self.copy(data) 90: WriteCommands.each{ |cmd| 91: IO.popen( cmd, 'w' ){ |input| input << data } 92: } 93: paste 94: end
# File lib/clipboard.rb, line 74 74: def self.paste(which = nil) 75: selection_string = if CLIPBOARDS.include?(which.to_s) 76: " -selection #{which}" 77: else 78: '' 79: end 80: %[#{ ReadCommand + selection_string }] 81: 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.