bing_dictionary 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d70a6f8f513205be899a6c608857494b9f6f0f1
4
- data.tar.gz: 64c7891d7be3db78dbb7b03af6e04149bc5766ff
3
+ metadata.gz: 8c815fd924860c6926cec410939ee4c1012a2698
4
+ data.tar.gz: 2a74d6e5d1bc2776ed51629feaf7f741d03a1e8c
5
5
  SHA512:
6
- metadata.gz: 4c3f39b00a791203d4a73a2ea610a3de370a8722d47d24fb40cb2b6f73bf7b2d4d8e621fef6187aef8ba1a51778450dada0b0cb5cf0d2c25089e73ebc2b36657
7
- data.tar.gz: 96be2ef7575babb693526e0671054734179512f7dc1322d7ca0237abc0925381b0383fffc2d94f765cfc4c994a58ae30e69079fc1a34c8a95bd8c283bc101220
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 = "Usage: dict [-p] hello"
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
- end.parse!
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
- BingDictionary::Base.translate(ARGV.join(' '), options) unless ARGV.empty?
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
@@ -1,3 +1,3 @@
1
1
  module BingDictionary
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -65,9 +65,9 @@ module BingDictionary
65
65
  puts
66
66
 
67
67
  content.css('.dym_area').each do |area|
68
- puts area.at_css('.df_wb_a').text
69
- puts area.css('.df_wb_c').map(&:text)
70
- puts
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.2
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-05-17 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler