Sha256: 9d2fa41ed86cea001379b66c4a1a3857338a4fc3dc86dec2032d987615cbe038

Contents?: true

Size: 677 Bytes

Versions: 7

Compression:

Stored size: 677 Bytes

Contents

class Blekko
  class SearchResult
    attr_accessor :n_group, :display_url, :rss, :rss_title, :short_host, :short_host_url,
                  :snippet, :toplevel, :url, :url_title, :doc_date_iso, :address, :geocluster,
                  :lat, :lon, :phone, :zip, :is_robots_banned
                  
    def initialize(result)
      result.each do |key, value|
        send("#{key}=", value) if respond_to? "#{key}="
      end
    end
    
    def datetime
      DateTime.parse(doc_date_iso) if doc_date_iso
    end
    
    def toplevel
      @toplevel == "1" ? true : false
    end
    
    alias_method :sequence, :n_group
    alias_method :abstract, :snippet
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blekko-search-0.0.7 lib/blekko-search/search_result.rb
blekko-search-0.0.6 lib/blekko-search/search_result.rb
blekko-search-0.0.5 lib/blekko-search/search_result.rb
blekko-search-0.0.4 lib/blekko-search/search_result.rb
blekko-search-0.0.3 lib/blekko-search/search_result.rb
blekko-search-0.0.2 lib/blekko-search/search_result.rb
blekko-search-0.0.1 lib/blekko-search/search_result.rb