Sha256: 5522768aec51d93b27d54fabb15e8c68c7b60dfb50b1f5fee9ea19b44932a468

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

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

    def execute
      @md_query = MDQueryNative.new(query_string)
      @md_query.set_search_scopes(@scopes)
      @md_query.execute
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spotlight-0.0.4 lib/spotlight/query.rb
spotlight-0.0.3 lib/spotlight/query.rb