Sha256: 33655aa75425d3a8b2aacac5af62013e64858b5ac7c79506c579a42c7437e5e0
Contents?: true
Size: 702 Bytes
Versions: 29
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true require 'os' module Branch module Name module Clipable module_function def copy_to_clipboard(text) if OS.mac? copy_to_clipboard_macos text true elsif OS.windows? copy_to_clipboard_windows text true else false end end def copy_to_clipboard_macos(text) copy_to_clipboard_with(app: 'pbcopy', text: text) end def copy_to_clipboard_windows(text) copy_to_clipboard_with(app: 'clip', text: text) end def copy_to_clipboard_with(app:, text:) IO.popen(app, 'w') { |pipe| pipe.puts text } end end end end
Version data entries
29 entries across 29 versions & 1 rubygems