class Profound::Input

Constants

Keywords
Qualifiers

Public Class Methods

new(source, options = {}) click to toggle source
# File lib/profound.rb, line 38
def initialize(source, options = {})
  @source = source || [Qualifiers.sample, Keywords.sample].join(" ")
  @options = options
end

Public Instance Methods

download() click to toggle source
# File lib/profound.rb, line 47
def download
  url = search

  response = Net::HTTP.get_response(URI.parse(url))

  tmp = Tempfile.new("profound")
  tmp.write(response.body)
  tmp.rewind
  tmp.path
end
path() click to toggle source
# File lib/profound.rb, line 43
def path
  File.exists?(@source) ? @source : download
end