Sha256: ae8e294c76c2070beac7ab399b37130a0f9fa39ac661f04b02a0f348b1410cad
Contents?: true
Size: 538 Bytes
Versions: 1
Compression:
Stored size: 538 Bytes
Contents
# -*- coding: utf-8 -*- require 'nokogiri' require 'dict/dictionary' DICT_URL = 'http://dict.pl/dict?word=' module Dict class Dictpl < Dictionary # Method returns hash with translations as keys and examples of using words as values def translate context_words = [] Nokogiri::HTML(open(@uri)).xpath('//td[@class="resWordCol"]/a').each do |node| context_words << node.text end make_hash_results(context_words) rescue OpenURI::HTTPError raise Dictionary::ConnectError end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dict-0.2.1 | lib/dict/dictpl.rb |