lib/spotlight/query.rb in spotlight-0.0.2 vs lib/spotlight/query.rb in spotlight-0.0.3
- old
+ new
@@ -1,8 +1,18 @@
+require 'rubygems'
+require 'plist'
+
module Spotlight
class Query
attr_reader :query_string
attr_accessor :scopes
+
+ def self.from_saved_search(filename)
+ plist = Plist::parse_xml(filename)
+ query = new(plist['RawQuery'])
+ query.scopes = plist['SearchCriteria']['FXScopeArrayOfPaths']
+ query
+ end
def initialize(query_string)
@query_string = query_string
@scopes = []
end