RubyTaban 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/RubyTaban.rb +35 -35
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e544a7c66375296c7ca789cf9e462a665cb59cda70ecd1186a55b6705bb649a7
4
- data.tar.gz: 6a8b5eba7b68c20d7ac0753185982c72f563ba2d6c9b6b05eb212a4a5dae22a7
3
+ metadata.gz: 0ee75161ab38bc90531b0cf36da91baea2a42182d63a1d46a141d064d143ad2e
4
+ data.tar.gz: 11e984ae06d8eaf2f02477b61d743dcd1938de010b61fdaae0b14d0191068084
5
5
  SHA512:
6
- metadata.gz: ea4eb5f42cea7e56e9da89cd0acdaadab03c4a7ff3047d6bee29a14ee249f13e0aea92723a7019635c82375d0b6842ee5a00137ba06f9e82938fd7af6dacd527
7
- data.tar.gz: cad1e8986de5198bf5e6fad86de89c795d658efd10e0556eff4e221fcd24904543b2468a4c89ead7c711932d9821f405710c532ae9bc902af0ec25f2005919a4
6
+ metadata.gz: 83600feb897358747ffd808ded78d428034d8a5afd6c5b93d0a166c6b6926556407fc61f1e9d99c1510b067881ba67272bb052ce71cdf63091c45661d9aa59bc
7
+ data.tar.gz: e32ce60b73eb9fea063cbaa619d5c5800c341e8be08f4febc5448757d96ee4e889fa45e669e2afd6feeb78fcef518b0e1fe9a4f12c263a98917cb5f9fd7df996
data/lib/RubyTaban.rb CHANGED
@@ -6,69 +6,69 @@ require 'json'
6
6
  using RubyFiglet
7
7
 
8
8
  class RubyTaban
9
- attr_accessor :banner,:girinti
9
+ attr_accessor :banner,:tabs
10
10
 
11
- def initialize(banner, girinti = 1)
11
+ def initialize(banner, tabs = 1)
12
12
  @banner = banner
13
- @girinti = girinti
14
- logo_yazdir()
15
- bilgi_yazdir()
13
+ @tabs = tabs
14
+ logo
15
+ information
16
16
  end
17
17
 
18
- def logo_yazdir()
19
- temizle()
20
- puts ((" " * @girinti).to_s + @banner + "\n\n").art!.green
18
+ def logo
19
+ clear
20
+ puts ((" " * @tabs).to_s + @banner + "\n\n").art!.green
21
21
  puts "\n\n"
22
22
  end
23
23
 
24
- def bilgi_yazdir()
24
+ def information
25
25
  time = Time.new
26
26
 
27
- oturum = (ENV['USERNAME'].to_s + "@" + ENV["COMPUTERNAME"].to_s).cyan.center(44)
28
- ip = global_ip().yellow.center(44)
29
- cihaz = ENV["OS"].red.center(44)
30
- zaman = ((time.strftime("%d-%m-%Y")).to_s + " | " + (time.strftime("%k:%M")).to_s).center(30)
27
+ session = (ENV['USERNAME'].to_s + "@" + ENV["COMPUTERNAME"].to_s).cyan.center(44)
28
+ ip = global_ip.yellow.center(44)
29
+ pc = ENV["OS"].red.center(44)
30
+ time_format = ((time.strftime("%d-%m-%Y")).to_s + " | " + (time.strftime("%k:%M")).to_s).center(30)
31
31
 
32
- bilgi = "\t\t#{cihaz}\n\t\t#{zaman.yellow}\n\n\t\t#{oturum}\n\t\t#{ip}"
33
- puts bilgi
32
+ information_text = "\t\t#{pc}\n\t\t#{time_format.yellow}\n\n\t\t#{session}\n\t\t#{ip}"
33
+ puts information_text
34
34
  puts "\n"
35
35
  end
36
36
 
37
- def log_salla(sol, orta, sag)
38
- zaman = Time.new.strftime("%k:%M:%S")
39
- if zaman[" "]
40
- zaman[" "] = "0"
37
+ def log(left, center, right)
38
+ time = Time.new.strftime("%k:%M:%S")
39
+ if time[" "]
40
+ time[" "] = "0"
41
41
  end
42
- if (!sol.is_a?(String) || !orta.is_a?(String) || !sag.is_a?(String))
43
- bicimlendir = "[#{zaman}]".cyan + " Sadece String Değere izin verilir".yellow
44
- puts bicimlendir
42
+ if (!left.is_a?(String) || !center.is_a?(String) || !right.is_a?(String))
43
+ format_text = "[#{time}]".cyan + " Sadece String Değere izin verilir".yellow
44
+ puts format_text
45
45
  return
46
46
  end
47
47
 
48
- sol1 = "#{sol[0,12]}".red + ("~".cyan if sol.length > 13).to_s
49
- orta1 = "#{orta[0,18]}".yellow + ("~".cyan if orta.length > 19).to_s
50
- sag1 = "#{sag[0,13]}".magenta + ("~".cyan if sag.length > 14).to_s
48
+ left1 = "#{left[0,12]}".red + ("~".cyan if left.length > 13).to_s
49
+ center1 = "#{center[0,18]}".yellow + ("~".cyan if center.length > 19).to_s
50
+ right1 = "#{right[0,13]}".magenta + ("~".cyan if right.length > 14).to_s
51
51
 
52
52
 
53
- bicimlendir = "[#{zaman}]".cyan + " #{sol1}" + (" " * (15 - sol[0,13].to_s.length)).to_s + "||".green + " #{orta1} " + (" " * (21 - orta[0,19].to_s.length)).to_s + "||".green + " #{sag1}"
54
- puts bicimlendir
53
+ format_text = "[#{time}]".cyan + " #{left1}" + (" " * (15 - left[0,13].to_s.length)).to_s + "||".green + " #{center1} " + (" " * (21 - center[0,19].to_s.length)).to_s + "||".green + " #{right1}"
54
+ puts format_text
55
55
  end
56
56
 
57
- def hata_salla(hata)
58
- zaman = Time.new.strftime("%k:%M:%S")
59
- if zaman[" "]
60
- zaman[" "] = "0"
57
+ def error(exception)
58
+ time = Time.new.strftime("%k:%M:%S")
59
+ if time[" "]
60
+ time[" "] = "0"
61
61
  end
62
62
 
63
- bicimlendir = "[#{zaman}]".cyan + " #{hata.class.name}".yellow + " || ".magenta + "#{hata.message}"
64
- puts bicimlendir
63
+ format_text = "[#{time}]".cyan + " #{exception.class.name}".yellow + " || ".magenta + "#{exception.message}"
64
+ puts format_text
65
65
  end
66
66
 
67
- def temizle()
67
+ def clear
68
68
  Gem.win_platform? ? (system "cls") : (system "clear")
69
69
  end
70
70
 
71
- def global_ip()
71
+ def global_ip
72
72
  begin
73
73
  uri = URI("http://ip-api.com/json")
74
74
  res = Net::HTTP.get_response(uri)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyTaban
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
  - Ömer Faruk Biçer