module RuboSpeller::Data

Constants

DATA_URL

Public Class Methods

check(phrase) click to toggle source
# File lib/rubospeller/data.rb, line 11
def self.check phrase
  special_format = format phrase
  result = JSON.load(open(URI.parse(URI.encode(DATA_URL+special_format))))
  result.empty? ? {} : result.inject({}) { |hash, word| hash[word['word']] = word['s']; hash  }
end
format(phrase) click to toggle source
# File lib/rubospeller/data.rb, line 17
def self.format phrase
  phrase_in_array = phrase.split
  phrase_in_array.join("+")
end