codic 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/codic.rb +18 -2
  2. data/lib/codic/version.rb +1 -1
  3. metadata +2 -2
@@ -60,8 +60,15 @@ module Codic
60
60
  puts result[:flections]
61
61
  puts
62
62
  end
63
+ puts "# 検索結果" unless result[:words].empty?
63
64
  result[:words].each do |w|
64
- puts "#{w[:no]}. #{w[:translated]} [#{w[:class_ja]}]"
65
+ class_ja = w[:class_ja].empty? ? "" : "(#{w[:class_ja]}"
66
+ puts "#{w[:no]}. #{w[:translated]} #{class_ja}"
67
+ end
68
+
69
+ puts "\n# 関連" unless result[:relations].empty?
70
+ result[:relations].each do |r|
71
+ puts "#{r[:seltext]} #{r[:digest]} #{r[:description]}"
65
72
  end
66
73
  when "naming"
67
74
  result[:words].each do |w|
@@ -100,10 +107,19 @@ module Codic
100
107
  }
101
108
  end
102
109
 
110
+ relations = @doc.css("#relations .entries li").map do |r|
111
+ {
112
+ seltext: r.at('.seltext').content,
113
+ digest: r.at('.digest').content,
114
+ description: r.at('.description').content
115
+ }
116
+ end
117
+
103
118
  {
104
119
  type: "english",
105
120
  flections: flections,
106
- words: words
121
+ words: words,
122
+ relations: relations
107
123
  }
108
124
  end
109
125
 
@@ -1,3 +1,3 @@
1
1
  module Codic
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri