Top Level Namespace
Defined Under Namespace
Modules: Copier
Instance Method Summary collapse
Instance Method Details
#Copier(text) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/copier.rb', line 50 def Copier(text) Copier.load_config unless Copier.config_loaded || Copier.disable_config_file if Copier.copy_method Copier.copy_method.call(text) return end if Copier.copy_file File.open(Copier.copy_file, 'w') {|io| io.write text } end 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") } when /linux/ IO.popen('xclip -selection clipboard', 'w') {|io| io.write text} else raise Copier::NotSupported, RUBY_PLATFORM + " is not supported yet by Copier." end end |