Sha256: 918cf66bb3210b7d0329fe1683c34276a17e94b08992f4ac58c1a7b26e53b0ea
Contents?: true
Size: 817 Bytes
Versions: 1
Compression:
Stored size: 817 Bytes
Contents
require 'systemu' module Irbcp Version = '0.0.1' 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/ raise 'fail!' # TODO ! 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.1 | lib/irbcp.rb |