Top Level Namespace

Defined Under Namespace

Modules: Copier

Instance Method Summary collapse

Instance Method Details

#Copier(text) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/copier.rb', line 5

def Copier(text)
  case RUBY_PLATFORM
  when /darwin/
    IO.popen('pbcopy', 'w') {|io| io.write text }
  when /cygwin/
    File.open('/dev/clipboard', 'wb') {|io| io.write text.gsub("\x0A", "\n") }
  else
    raise Copier::NotSupported, RUBY_PLATFORM + " is not supported yet by Copier."
  end
end