Pasteboard 1.0 Released

pasteboard version 1.0 has been released!

Pasteboard wraps the OS X system pasteboard. Pasteboard allows you to
add
and retrieve multiple items and multiple item flavors to the pasteboard
unlike
+pbpaste+ and +pbcopy+ which only allow text.

== FEATURES/PROBLEMS:

  • Supports multiple pasteboards
  • Returns data with the proper encoding
  • Built in library of types in Pasteboard::Type
  • Does not understand type conformance (Pasteboard::Type::IMAGE will not
    retrieve a Pasteboard::Type::JPEG)

== SYNOPSIS:

require ‘pasteboard’

pasteboard = Pasteboard.new

Adding a URL to the clipboard:

pasteboard.put_url ‘http://blog.segment7.net’, ‘my blog’

Adding a JPEG with URL to the clipboard:

pasteboard.put_jpeg_url jpeg, ‘http://example’, ‘my cool jpeg’

Adding other data to the clipboard (TIFF + URL):

item = [
[Pasteboard::Type::TIFF, tiff],
[Pasteboard::Type::URL, url],
[Pasteboard::Type::URL_NAME, url],
[Pasteboard::Type::UTF_8, url],
]

pasteboard.put item

Retrieving data from the clipboard:

require ‘pasteboard’

pb = Pasteboard.new

pb.first # => all flavors, see Pasteboard#[]

pb.first Pasteboard::Type::TIFF # => TIFF data

See also sample/image.rb and sample/dump.rb