Module: Speller::Query

Defined in:
lib/speller/query.rb

Constant Summary collapse

QUERY_TO_YANDEX =
'http://speller.yandex.net/services/spellservice.json/checkText?'

Class Method Summary collapse

Class Method Details

.send(word) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/speller/query.rb', line 8

def self.send word

  query_to_yandex_with_word = QUERY_TO_YANDEX + 'text=' + word
  encode_query_to_yandex_with_word = URI.encode query_to_yandex_with_word
  open URI.parse encode_query_to_yandex_with_word

rescue Errno::ETIMEDOUT, SocketError
  puts "Please, check your network connect!"
end