Class: YandexTranslator::JSONParser

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Celluloid::Notifications
Defined in:
lib/parsers/json_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(text, index) ⇒ Object



8
9
10
11
12
# File 'lib/parsers/json_parser.rb', line 8

def parse(text, index)
  response = JSON.parse(text)
  response["text"] = response["text"].inject {|elm, sum| elm + sum} if response["text"].is_a? Array
  publish(:parsing_done, response, index)
end