Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
require 'osx/cocoa' module OSXApps class Base def self.all OSX::NSWorkspace.sharedWorkspace.launchedApplications.map do |app| {:name => app.allValues[5].to_s, :pid => app.allValues[1].to_i} end end def self.find(name) all.find { |app| app[:name].match(name) } end end end if $0 == __FILE__ puts OSXApps.find('Terminal').inspect end
From the Design Piracy series on my blog: