Class: GitCloud::Clipboard
- Inherits:
-
Object
- Object
- GitCloud::Clipboard
- Defined in:
- lib/git_cloud/clipboard.rb
Class Method Summary collapse
-
.copy(text) ⇒ Object
Public: copies the given text to the clipboard.
Class Method Details
.copy(text) ⇒ Object
Public: copies the given text to the clipboard. This method is designed to handle multiple platforms.
text - String to copy to the clipboard
Returns nothing.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/git_cloud/clipboard.rb', line 14 def copy(text) copy_command = if RUBY_PLATFORM =~ /darwin/ "pbcopy" else "xclip -selection clipboard" end `echo #{text} | #{copy_command}` "Copied #{text} to your clipboard." end |