tta_terms_api 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/lib/tta_terms_api/version.rb +1 -1
- data/lib/tta_terms_api.rb +7 -6
- data/tta_terms_api.gemspec +1 -1
- 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: aa3c3e7037a14f46cb4826341d9410c95694bf17
|
4
|
+
data.tar.gz: cc59fff06c4ecf7db854194252cb14217deffe6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85ef28a504524644fe566f00bfc1d1d81040e79440d6a103f40a3e0c1321551dd022b1e4c05e21f7cb3b0f4b601a88e199b9372d77a4de8f0689139b5825ce75
|
7
|
+
data.tar.gz: 50442a28c2cdac96db34b8868571b3f55441c26634760ab3646bc56a31ca5e7d77ebfd45aa581712ac6fff234031fefc1109a2ed1518b6ab9cb65e906d200b62
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# TtaTermsApi
|
2
2
|
|
3
|
-
Ruby interface to [정보 통신 용어 사전
|
3
|
+
Ruby interface to [Korean IT terms(정보 통신 용어 사전)](http://word.tta.or.kr/terms/terms.jsp)
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -25,8 +25,14 @@ ruby >= 1.9
|
|
25
25
|
To start using the gem, you can either perform direct calls on `TtaTermsApi`
|
26
26
|
|
27
27
|
``` ruby
|
28
|
-
TtaTermsApi.list search: "commit"
|
28
|
+
words_criteria = TtaTermsApi.list search: "commit"
|
29
|
+
# => [#<struct TtaTermsApi::WordCriteria name="완료", options={:gubun=>"4", :terms_num=>"4-290", :title=>"%BF%CF%B7%E1%7Ccommit%7C", :title_gubun=>"kor", :gubun2=>"", :terms_num2=>"", :title2=>"", :title2_gubun=>"", :gabora_gubun=>"", :popular=>"false"}>, #<struct TtaTermsApi::WordCriteria name="커미트", options={:gubun=>"1", :terms_num=>"17625", :title=>"%C4%BF%B9%CC%C6%AE%7Ccommit%7C", :title_gubun=>"kor", :gubun2=>"", :terms_num2=>"", :title2=>"", :title2_gubun=>"", :gabora_gubun=>"", :popular=>"false"}>]
|
30
|
+
|
31
|
+
words_criteria.first.to_word
|
32
|
+
# => #<struct TtaTermsApi::Word name="commit", origin="완료", type="", similar="북한말 : 결속", description=nil>
|
33
|
+
|
29
34
|
TtaTermsApi.view gubun: 1, terms_num: 17624
|
35
|
+
# => #<struct TtaTermsApi::Word name="커뮤니케이터", origin="Communicator", type=" [컴퓨터]", similar="", description="☞넷스케이프 커뮤니케이터.">
|
30
36
|
```
|
31
37
|
|
32
38
|
## Contributing
|
data/lib/tta_terms_api.rb
CHANGED
@@ -5,12 +5,12 @@ require 'open-uri'
|
|
5
5
|
|
6
6
|
module TtaTermsApi
|
7
7
|
BASE_URL = "http://word.tta.or.kr/terms/"
|
8
|
-
|
8
|
+
WordCriteria = Struct.new(:name, :options) do
|
9
9
|
def to_word
|
10
|
-
TtaTermsApi.view(
|
10
|
+
TtaTermsApi.view(options)
|
11
11
|
end
|
12
12
|
end
|
13
|
-
Word = Struct.new(:name, :origin, :type, :description)
|
13
|
+
Word = Struct.new(:name, :origin, :type, :similar, :description)
|
14
14
|
|
15
15
|
def self.list(options)
|
16
16
|
html = html(:list, options)
|
@@ -20,7 +20,7 @@ module TtaTermsApi
|
|
20
20
|
name = tr.children.first.text.gsub("\n","")
|
21
21
|
script = tr.css(".input_size0").attr("onkeydown").value
|
22
22
|
script.match(/sendData\(\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'(.*)',\s*'([^']*)'\s*\)/)
|
23
|
-
|
23
|
+
WordCriteria.new name,
|
24
24
|
gubun: $1,
|
25
25
|
terms_num: $2,
|
26
26
|
title: $3,
|
@@ -35,8 +35,8 @@ module TtaTermsApi
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.view(options)
|
38
|
-
name, origin, type,
|
39
|
-
Word.new name, origin, type, description
|
38
|
+
name, origin, type, similar, description = html(:view, options).css("#printSpace font").text.gsub("\t", "").split(/\n/)
|
39
|
+
Word.new name, origin, type, similar, description
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.html(type, options)
|
@@ -44,3 +44,4 @@ module TtaTermsApi
|
|
44
44
|
Nokogiri::HTML(open(uri), nil, "EUC-KR")
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
data/tta_terms_api.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = TtaTermsApi::VERSION
|
9
9
|
spec.authors = ["Shim Tw"]
|
10
10
|
spec.email = ["marocchino@gmail.com"]
|
11
|
-
spec.summary = %q{Ruby interface to 정보 통신 용어 사전
|
11
|
+
spec.summary = %q{Ruby interface to Korean IT terms(정보 통신 용어 사전)}
|
12
12
|
spec.description = ""
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tta_terms_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shim Tw
|
@@ -106,7 +106,7 @@ rubyforge_project:
|
|
106
106
|
rubygems_version: 2.2.0
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
|
-
summary: Ruby interface to 정보 통신 용어 사전
|
109
|
+
summary: Ruby interface to Korean IT terms(정보 통신 용어 사전)
|
110
110
|
test_files:
|
111
111
|
- spec/spec_helper.rb
|
112
112
|
- spec/tta_terms_api_spec.rb
|