bing_dictionary 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dict +21 -5
- data/lib/bing_dictionary/version.rb +1 -1
- data/lib/bing_dictionary.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c815fd924860c6926cec410939ee4c1012a2698
|
4
|
+
data.tar.gz: 2a74d6e5d1bc2776ed51629feaf7f741d03a1e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c80f47b478f95e684a23cf71a25ce9fea3d2aa2d44cc41dd327dd6f815f0c2e9f50acb0333eb6b2d4ea12ba258e89c9f444f6bb64ac43f16f9c626852023ce3b
|
7
|
+
data.tar.gz: c07bcf66d85f0d60ae7487cae295df5e0dde29083550a21fe515fd685309519ee234014cb5b9d2f24b97aefd4054c9eb0f6d2b4b128e9476480a8d45b2cd1cff
|
data/bin/dict
CHANGED
@@ -4,12 +4,28 @@ require "bing_dictionary"
|
|
4
4
|
require 'optparse'
|
5
5
|
|
6
6
|
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "
|
9
|
-
|
7
|
+
option_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Example: dict hello"
|
10
9
|
opts.on("-p", "--[no-]pronounce", "Pronounce the word") do |v|
|
11
10
|
options[:pronounce] = v
|
12
11
|
end
|
13
|
-
|
12
|
+
opts.on("-j", "--[no-]jump", "Jump to web page") do |v|
|
13
|
+
options[:jump] = v
|
14
|
+
end
|
15
|
+
opts.on("-v", "--version", "Show the version") do |v|
|
16
|
+
options[:version] = v
|
17
|
+
end
|
18
|
+
end
|
14
19
|
|
15
|
-
|
20
|
+
if ARGV.empty?
|
21
|
+
option_parser.parse('--help')
|
22
|
+
else
|
23
|
+
option_parser.parse!
|
24
|
+
if options[:version]
|
25
|
+
puts BingDictionary::VERSION
|
26
|
+
elsif options[:jump]
|
27
|
+
`open http://cn.bing.com/dict/?q=#{CGI::escape(ARGV.join(' '))}`
|
28
|
+
else
|
29
|
+
BingDictionary::Base.translate(ARGV.join(' '), options)
|
30
|
+
end
|
31
|
+
end
|
data/lib/bing_dictionary.rb
CHANGED
@@ -65,9 +65,9 @@ module BingDictionary
|
|
65
65
|
puts
|
66
66
|
|
67
67
|
content.css('.dym_area').each do |area|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
puts area.at_css('.df_wb_a').text
|
69
|
+
puts area.css('.df_wb_c').map(&:text)
|
70
|
+
puts
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bing_dictionary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lingceng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|