Module: Clipboard::Gtk
Constant Summary collapse
- CLIPBOARDS =
%w[CLIPBOARD PRIMARY SECONDARY].freeze
Instance Method Summary collapse
Instance Method Details
#clear ⇒ Object
41 42 43 44 45 |
# File 'lib/clipboard/gtk.rb', line 41 def clear CLIPBOARDS.each{ |which| ::Gtk::Clipboard.get(Gdk::Selection.const_get(which)).clear } end |
#copy(text) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/clipboard/gtk.rb', line 24 def copy(text) CLIPBOARDS.each{ |which| ::Gtk::Clipboard.get(Gdk::Selection.const_get(which)).set_text(text).store } paste end |
#paste(which = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/clipboard/gtk.rb', line 31 def paste(which = nil) if !which || !CLIPBOARDS.include?(which_normalized = which.to_s.upcase) which_normalized = CLIPBOARDS.first end ::Gtk::Clipboard.get( Gdk::Selection.const_get(which_normalized) ).wait_for_text || "" end |