Sha256: b19b587e43c590099528b745e84d653fa7d80ff7abbecfad6d0c7d05717ba5a1
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'systemu' module Irbcp Version = '0.0.4' def Irbcp.version() Irbcp::Version end case RUBY_PLATFORM when /darwin/ Copy = 'pbcopy' Paste = 'pbpaste' when /linux/ Copy = 'xsel -clipboard -input' Paste = 'xsel -clipboard -output' when /windoze/ ## Windows Server 2003 , Windows Vista , Windows 7. Anything else don t have and don t matter anymore :) # Copy = 'clip.exe' ## download paste.exe from http://www.c3scripts.com/tutorials/msdos/paste.html#exe # Paste = 'paste.exe' end def copy(*args) stdin = args.join systemu(Copy, :stdin => stdin) stdin end def paste(*args) stdout = '' systemu(Paste, :stdout => stdout) stdout end def cp(*args) args.size==0 ? paste(*args) : copy(*args) end extend(self) end IrbCp = Irbcp module Kernel private %w( copy paste cp ).each do |method| module_eval <<-__ def #{ method }(*args, &block) Irbcp.#{ method }(*args, &block) end __ end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
irbcp-0.0.4 | lib/irbcp.rb |