bilisim_sozlugu 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8fceb1e2382066c32d45a1109cb707c01e80e5b
4
- data.tar.gz: 4d4ebbd30704313a338052e213c6a92ce54f189a
3
+ metadata.gz: f25847a76600e63082fbfc6eedc61e25780ed38b
4
+ data.tar.gz: 196c94fbf9c0f51fd2433392b8921b2f9eb57426
5
5
  SHA512:
6
- metadata.gz: d58524ec102131818ad980520193929c684e24b4e8af25cdb30ffc10026c98fc60ba98c1f43f5f119a85643ee550fc5e8ce05e59fdb86932c45ad2cd1471b7ef
7
- data.tar.gz: 6755e393a319857990d36cd77323251f126063bc830cc961d315d7cb0d71eeda7caa8f5e2f81c4d35da5e8793e0b736ccd78ca2e8650acfa7238fc1d9faeb79e
6
+ metadata.gz: 81f9297fb6a72726eb790e3b18589960d8553412a6a3feb5c772b7f947375f7d1b7ef8d1dbf9a63b00847231982489f660cf79227349a7569665c9e1acc6ef50
7
+ data.tar.gz: 477284e53771ae2a16592379db7c27ac9dd0f3515962b798c59e05097b7b5b4f0dc940a3c56d1aadd5d90308df9ad7cabc8e304e3fa807f8f710531b4a8f0f4f
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.executables = 'sozluk'
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bilisim_sozlugu'
3
+
4
+ if ARGV.empty?
5
+ puts "Lütfen geçerli bir komut giriniz."
6
+ else
7
+ puts "Lütfen bekleyiniz...\n"
8
+ BilisimSozlugu.search(ARGV[0])
9
+ end
@@ -6,19 +6,17 @@ require 'terminal-table'
6
6
  require "bilisim_sozlugu/version"
7
7
 
8
8
  module BilisimSozlugu
9
- URL = "http://www.tbd.org.tr/index.php?sayfa=sozluk&mi1&tipi=ara&harf=A&arama="
9
+ URL = "http://www.tbd.org.tr/index.php?sayfa=sozluk&mi1&tipi=ara&harf=A&arama=".freeze
10
+ CSS_SELECTOR = "table tbody tr".freeze
10
11
 
11
12
  def self.search(word)
12
- words = []
13
13
  call_url = URL + word
14
14
  page = Nokogiri::HTML(open(call_url))
15
- rows = page.css("table").css('tbody').css('tr')
15
+ rows = page.css(CSS_SELECTOR)
16
16
  if rows.last.text == "Aranan Kelime "
17
17
  puts "Aradığınız kelime bulunamadı."
18
18
  else
19
- rows.each do |row|
20
- words << [row.children.first.children.text, row.children.last.text]
21
- end
19
+ words = rows.map { |row| [row.children.first.children.text, row.children.last.text] }
22
20
  table = Terminal::Table.new :rows => words.drop(2)
23
21
  puts table
24
22
  end
@@ -1,3 +1,3 @@
1
1
  module BilisimSozlugu
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bilisim_sozlugu
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
  - Ender Ahmet Yurt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,7 +70,8 @@ description: Translating English words which are used in computer world to Turki
70
70
  from Informatics Association of Turkey offical website.
71
71
  email:
72
72
  - enderyurt@gmail.com
73
- executables: []
73
+ executables:
74
+ - sozluk
74
75
  extensions: []
75
76
  extra_rdoc_files: []
76
77
  files:
@@ -80,6 +81,7 @@ files:
80
81
  - README.md
81
82
  - Rakefile
82
83
  - bilisim_sozlugu.gemspec
84
+ - bin/sozluk
83
85
  - lib/bilisim_sozlugu.rb
84
86
  - lib/bilisim_sozlugu/version.rb
85
87
  homepage: ''