tta_terms_api 0.0.1 → 0.0.2

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: aade2f433fc3b43bda27a170dd5de2eff017b54f
4
- data.tar.gz: 64a1f73a18bd37e266ff391fe70fc76f3cf6a67e
3
+ metadata.gz: aa3c3e7037a14f46cb4826341d9410c95694bf17
4
+ data.tar.gz: cc59fff06c4ecf7db854194252cb14217deffe6c
5
5
  SHA512:
6
- metadata.gz: 86eea325b0b73f881ef5d36d3e79140d6132b31be659c6fe898713f308399c5b408cd0db18dddc8b5c059631cc53f83e1b88f97c8cc420c8ace999f800bc2e93
7
- data.tar.gz: 0b14b8eae7aa96ef9e8667b162ecb175386c79b310d3a44732dc21c806c33b883c701f98e8ff8f9d73d1c4a27a8245d2bc92e7e27e7b559490034ec83262334e
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 [정보 통신 용어 사전(telecommunication word terms)](http://word.tta.or.kr/terms/terms.jsp)
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
@@ -1,3 +1,3 @@
1
1
  module TtaTermsApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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
- WordCritria = Struct.new(:name, :options) do
8
+ WordCriteria = Struct.new(:name, :options) do
9
9
  def to_word
10
- TtaTermsApi.view(@options)
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
- WordCritria.new name,
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, _, description = html(:view, options).css("#printSpace font").text.gsub("\t", "").split(/\n/)
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
+
@@ -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 정보 통신 용어 사전(telecommunication word terms)}
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.1
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 정보 통신 용어 사전(telecommunication word terms)
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