fy 0.1.0 → 1.0.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/fy +1 -1
  3. data/lib/fy/fanyi.rb +8 -8
  4. data/lib/fy/version.rb +1 -1
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef0affb248ffba366abc2ea48559885b92ec3910
4
- data.tar.gz: 2e6cad6bbf4e4c4835f7e004991d46c017b48197
3
+ metadata.gz: 956cb074af820b4bce5c4fa549eb02dbe35d6da8
4
+ data.tar.gz: 4e0ace04344f0213b5d3390f7fc48e4869670286
5
5
  SHA512:
6
- metadata.gz: c4a9c06c38c7d6adb159308295786f512e4f49847f43b9416b21374117485d65a091fc09a6a90b29494684e942fe95bdc40d54b865ac342afd7f3a10bacd716f
7
- data.tar.gz: f9d22a4d5792c7c1a2a713fe0470f56cb9a5eed567b25f426b8e5d25eeda06958f55ef019c2555fd3fd49d18704cc90417aacca949a4dc074188d1e492216ae4
6
+ metadata.gz: 824222907a2296150b94c6704c937c5e303f1660e9a0c8d643f239b962315ad6bf19d92db580469f52e8498198791ec7b43305672198a3190243303dd65e5435
7
+ data.tar.gz: 7cd1623d07db4fbd695b9ae4378058f2c49e7c414102550f9aafe5979654b07818efb33c261d017d4fd5c669c470e6046581db8c2288d44c42cf565f51de19a4
data/bin/fy CHANGED
@@ -23,7 +23,7 @@ if ARGV.empty?
23
23
  rescue Interrupt
24
24
  puts 'bye~'
25
25
  end
26
- elsif %w{-h --help}.any?{ |c| ARGV.include? c }
26
+ elsif %w{-h --help}.any? { |c| ARGV.include? c }
27
27
  puts help
28
28
  else
29
29
  puts Fy::Fanyi.new(ARGV.join(' ')).result
data/lib/fy/fanyi.rb CHANGED
@@ -16,29 +16,29 @@ module Fy
16
16
  end
17
17
 
18
18
  def query_for_hash
19
- query_url = api_url + URI.escape( @words.gsub(/ /, '+') )
20
- result_json = Net::HTTP.get( URI(query_url) )
19
+ query_url = api_url + URI.escape(@words.gsub(/ /, '+'))
20
+ result_json = Net::HTTP.get(URI(query_url))
21
21
  @result_hash = JSON.parse(result_json)
22
22
  end
23
23
 
24
24
  def translations
25
25
  translations = @result_hash["translation"]
26
- lines = translations.collect do |translation|
26
+ lines = translations.collect do |translation|
27
27
  " " + translation.color(:green)
28
28
  end
29
29
  lines << ""
30
30
  end
31
31
 
32
32
  def word_and_phonetic
33
- line = " " + @words
33
+ line = " " + @words
34
34
  phonetic = @result_hash["basic"]["phonetic"] if @result_hash["basic"]
35
- line += " [ #{phonetic} ]".color(:magenta) if phonetic
35
+ line += " [ #{phonetic} ]".color(:magenta) if phonetic
36
36
  [line, ""]
37
37
  end
38
38
 
39
39
  def dict_explains
40
40
  dict_explains = @result_hash["basic"]["explains"] if @result_hash["basic"]
41
- lines = dict_explains.collect do |explain|
41
+ lines = dict_explains.collect do |explain|
42
42
  " - " + explain.color(:green)
43
43
  end
44
44
  lines << ""
@@ -46,10 +46,10 @@ module Fy
46
46
 
47
47
  def web_results
48
48
  return [] unless @result_hash["web"]
49
- lines = []
49
+ lines = []
50
50
  web_results = @result_hash["web"]
51
51
  web_results.each_with_index do |web_result, i|
52
- web_result_key = web_result["key"].gsub(/#{@words}/i, @words.color(:yellow))
52
+ web_result_key = web_result["key"].gsub(/#{@words}/i, @words.color(:yellow))
53
53
  web_result_value = web_result["value"].join(', ').color(:cyan)
54
54
  lines << " #{i+1}. #{web_result_key}"
55
55
  lines << " #{web_result_value}"
data/lib/fy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fy
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JIANG Di
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-29 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.4.5
92
+ rubygems_version: 2.4.6
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: A translate tool in your command line