iciba 0.0.12 → 0.0.13

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.
data/bin/fy CHANGED
@@ -6,11 +6,12 @@ require 'readability'
6
6
  require 'fileutils'
7
7
 
8
8
  $links = false
9
+ $extended = true
9
10
 
10
11
  OptionParser.new do |opts|
11
12
  opts.banner = "Usage: #{File.basename($0)} ('words'|word)"
12
13
  opts.on("-l", "--links", "Download links?") { |b| $links = true }
13
- opts.on("-e", "--extended", "Extended") { |b| $extended = true }
14
+ opts.on("-s", "--single", "Single word") { |b| $extended = false }
14
15
  opts.on("-p", "--pinyin", "Pinyin") { |b| $pinyin = true }
15
16
  opts.on("-o", "--open", "go to fy.iciba.com") { |b| $pinyin = true }
16
17
  opts.on("-h", "--help", "Print") do
@@ -45,7 +45,7 @@ module Iciba
45
45
 
46
46
  def download_and_parse(words, dir, extended)
47
47
  self.response = Iciba::Tools.parse(Iciba::Tools.post('http://fy.iciba.com/api.php', {:q => words, :type => dir}).body_str)
48
- self.html = self.response.ret.force_encoding("UTF-8")
48
+ self.html = self.response.ret.encode("UTF-8")
49
49
  self.result = (Iciba::Tools.doc(self.html)/'span.dd').text.strip
50
50
  self.result = self.html if self.result == ""
51
51
  self.result = self.result.split(',')[0] if self.result.include?(',') unless extended
@@ -1,3 +1,3 @@
1
1
  module Iciba
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iciba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: