Sha256: 9de4b7a4ada8f3328147ce577c92edae65604a8a5bfb5d406a689de15fcfe9ee

Contents?: true

Size: 550 Bytes

Versions: 8

Compression:

Stored size: 550 Bytes

Contents

module Clipboard; end

# Basic java clipboard access (jruby). No fun to use on X.
module Clipboard::Java
  extend self

  FLAVOR = ::Java::JavaAwtDatatransfer::DataFlavor.stringFlavor

  def copy(text)
    selection_string = ::Java::JavaAwtDatatransfer::StringSelection.new text
    ::Java::JavaAwt::Toolkit.default_toolkit.system_clipboard.set_contents selection_string, nil
    paste
  end

  def paste(_ = nil)
    ::Java::JavaAwt::Toolkit.default_toolkit.system_clipboard.get_data(FLAVOR)
  rescue
    ''
  end

  def clear
    copy ''
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
clipboard-1.1.0 lib/clipboard/java.rb
clipboard-1.0.6 lib/clipboard/java.rb
clipboard-1.0.5 lib/clipboard/java.rb
clipboard-1.0.4 lib/clipboard/java.rb
clipboard-1.0.3 lib/clipboard/java.rb
clipboard-1.0.2 lib/clipboard/java.rb
clipboard-1.0.1 lib/clipboard/java.rb
clipboard-1.0.0 lib/clipboard/java.rb