The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
pasteboard 1.0

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
pasteboard 1.0 Posted: Mar 28, 2011 4:49 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: pasteboard 1.0
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement

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

Read: pasteboard 1.0

Topic: pasteboard 1.0 Previous Topic   Next Topic Topic: Readable Clojure Without a Java Equivalent?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use