Module: PbcopyRuby

Included in:
Object
Defined in:
lib/pbcopy-ruby.rb,
lib/pbcopy-ruby/version.rb

Overview

Provides a global function to copy text to the system clipboard

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#pbcopy(text) ⇒ String

Copy the given text to the system clipboard using pbcopy

Parameters:

  • text (String)

    the text to copy to clipboard

Returns:

  • (String)

    the text that was copied



13
14
15
16
# File 'lib/pbcopy-ruby.rb', line 13

def pbcopy(text)
  IO.popen("pbcopy", "w") { |io| io.write(text.to_s) }
  text
end