dictuby 0.0.6 → 0.0.7

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: 3138302a2704df1949dad563f69d8f665a9e9e89
4
- data.tar.gz: 2fea28a250e63a449f411b4f9c6c17603b710cec
3
+ metadata.gz: fe4107b51d0b403e947b655cc5c8b03e5e44812f
4
+ data.tar.gz: a6c824d9da680812fd881d67abf2f2fc98ecf174
5
5
  SHA512:
6
- metadata.gz: 2b0fdcf8f44e2e6f9cf7e3b810ce9ef3eb2a879f3cc51d18ab3afbc7b244c0f357f947cf7b9698cd1782840f658482ccf4ada6750df721761b6ef39f20127db4
7
- data.tar.gz: fa46e9a16aefc15e2efba45825e5dbea9806b4ae5efef1d92805b8aa788bd2deb07eecdfd7c2c8aaf36a12ee9674723cb9654b30817cc38562846ed838c9296a
6
+ metadata.gz: 2e582f865d2a5de6a8b381147cd8e86da7193fd5bba0cfcdad53dd1113084d3a015e036324a59d093d386955c12491401e92837c53fb31f62e08934ec2c021ea
7
+ data.tar.gz: 2056910517c82a021dff2770f2aa3d2d245efa462c43772b8aa2bdf0a810c791d53241e168a0e257e3829d82b838b7c397ce1e897bce330e46abbe35874036b8
@@ -38,9 +38,13 @@ module Dictuby
38
38
  p.dicts.keys.each {|d| r[d] = p}; r
39
39
  end
40
40
 
41
- puts query
42
- map[dict].lookup(dict, query).each do |word|
43
- puts "- #{word}"
41
+ if map.include?(dict)
42
+ puts query
43
+ map[dict].lookup(dict, query).each do |word|
44
+ puts "- #{word}"
45
+ end
46
+ else
47
+ puts 'Invalid dictionary'
44
48
  end
45
49
  end
46
50
  end
@@ -21,9 +21,9 @@ module Dictuby
21
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
+ query = query.normalize
25
25
  left = page.xpath('//table[1]//span')[0].text rescue nil
26
- left = I18n.transliterate(left)
26
+ left.normalize!
27
27
  return [] unless left == query
28
28
 
29
29
  right = page.xpath(
@@ -17,12 +17,11 @@ module Dictuby
17
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
+ query = query.normalize
21
21
  pairs = page.xpath('//div[@class="pair"]')
22
22
 
23
23
  pairs.inject([]) do |right, pair|
24
- left = pair.xpath('span[@class="l"]')[0].text
25
- left = I18n.transliterate(left)
24
+ left = pair.xpath('span[@class="l"]')[0].text.normalize
26
25
  return right if left != query
27
26
  right << pair.xpath('span[@class="r"]')[0].text
28
27
  end
data/lib/dictuby.rb CHANGED
@@ -5,6 +5,7 @@ require 'nokogiri'
5
5
  require 'open-uri'
6
6
  require 'i18n'
7
7
 
8
+ require 'dictuby/string'
8
9
  require 'dictuby/runner'
9
10
  require 'dictuby/args_parser'
10
11
  require 'dictuby/config'
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rene Klacan