dictuby 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8e75a4e136c6a5d02d7de1765ddfdfcc49f29a5
4
- data.tar.gz: ade3c507a7e2c26a26fa5071accf0db18b062795
3
+ metadata.gz: 3138302a2704df1949dad563f69d8f665a9e9e89
4
+ data.tar.gz: 2fea28a250e63a449f411b4f9c6c17603b710cec
5
5
  SHA512:
6
- metadata.gz: 70b2b58460bdf0a038dafc37a2541352e5766f257e4c6511e39901a38235c60ff51089ddbb3a8a1d6574dafdaf19aa6f1bfb09817eb52edd6e64a7bde6c2545b
7
- data.tar.gz: 0e8e1baadab89cc9192c7a9db717e943a1861544afcce229dd2196e15e87f5562c2b8189fad6f66f95fba3f1aab8f90baf8429530a960ac9079bf9572a6b2547
6
+ metadata.gz: 2b0fdcf8f44e2e6f9cf7e3b810ce9ef3eb2a879f3cc51d18ab3afbc7b244c0f357f947cf7b9698cd1782840f658482ccf4ada6750df721761b6ef39f20127db4
7
+ data.tar.gz: fa46e9a16aefc15e2efba45825e5dbea9806b4ae5efef1d92805b8aa788bd2deb07eecdfd7c2c8aaf36a12ee9674723cb9654b30817cc38562846ed838c9296a
@@ -18,11 +18,14 @@ module Dictuby
18
18
  'ru-sk' => 'rusko-slovensky',
19
19
  'sk-ru' => 'slovensko-rusky',
20
20
  }
21
- @url = "http://slovnik.azet.sk/preklad/%{dict}/?q=%{query}"
21
+ @url = 'http://slovnik.azet.sk/preklad/%{dict}/?q=%{query}'
22
22
 
23
23
  def self.process(page, query)
24
+ query = I18n.transliterate(query)
24
25
  left = page.xpath('//table[1]//span')[0].text rescue nil
26
+ left = I18n.transliterate(left)
25
27
  return [] unless left == query
28
+
26
29
  right = page.xpath(
27
30
  '//table[1]//tr/td[@class="do"]/span'
28
31
  ).inject([]) {
@@ -14,15 +14,17 @@ module Dictuby
14
14
  'sp-cz' => 'spcz.sp',
15
15
  'cz-sp' => 'spcz.cz',
16
16
  }
17
- @url = "http://slovnik.cz/bin/mld.fpl?vcb=%{query}&dictdir=%{dict}&lines=30&js=0"
17
+ @url = 'http://slovnik.cz/bin/mld.fpl?vcb=%{query}&dictdir=%{dict}&lines=30&js=0'
18
18
 
19
19
  def self.process(page, query)
20
+ query = I18n.transliterate(query)
20
21
  pairs = page.xpath('//div[@class="pair"]')
21
22
 
22
- pairs.inject([]) do |xright, pair|
23
+ pairs.inject([]) do |right, pair|
23
24
  left = pair.xpath('span[@class="l"]')[0].text
24
- return xright if left != query
25
- xright << pair.xpath('span[@class="r"]')[0].text
25
+ left = I18n.transliterate(left)
26
+ return right if left != query
27
+ right << pair.xpath('span[@class="r"]')[0].text
26
28
  end
27
29
  end
28
30
  end
data/lib/dictuby.rb CHANGED
@@ -3,6 +3,7 @@ require 'optparse'
3
3
  require 'yaml'
4
4
  require 'nokogiri'
5
5
  require 'open-uri'
6
+ require 'i18n'
6
7
 
7
8
  require 'dictuby/runner'
8
9
  require 'dictuby/args_parser'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dictuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rene Klacan