class Plagiarism::TextSearch

Public Class Methods

new(search_text, options = {}) click to toggle source
# File lib/plagiarism/text_search.rb, line 4
def initialize(search_text, options = {})
  validate_text(search_text)
  params = {e: "UTF-8", t: search_text}.merge!(search_params(options))
  @request = Request.new(:post, params)
  @response = @request.response
end

Private Instance Methods

validate_text(text) click to toggle source
# File lib/plagiarism/text_search.rb, line 15
def validate_text(text)
  raise "Invalid or missing search text." if text.class != String || text.nil? || text == ""
  raise "Search text must be at least 15 words." if text.split(" ").size < 15
end