smooth_terminal_print 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/smooth_terminal_print.rb +37 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 196b6528f01de22e4e69d8186712fd223db0a40f
|
4
|
+
data.tar.gz: 3ad41e7a55d2281a052e42e9e599e4ada72a4264
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30902b9db313ac36f751d87029dc7253fa0f55c985a16d2a0e70ceceb5735ba2df4220e7c3fb39221d6cce61d380a9d2a3b649e03962e4e68e7788b4e9c3cad2
|
7
|
+
data.tar.gz: 121ad3c5b4c0bc7fb83a5f977b2fe1f09db86bc07c6239cf416ced8c7706850bf8c262a0c73522c273c3f114929c1e5ff7a7ce7aeb7307cd26206cdb264afa42
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SmoothTerminalPrint
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def start(&block)
|
5
|
+
@stp_reset_timer ||= Time.now.to_i
|
6
|
+
|
7
|
+
if(Time.now.to_i - @stp_reset_timer > 1)
|
8
|
+
print "\e[2J"
|
9
|
+
@stp_reset_timer = Time.now.to_i
|
10
|
+
end
|
11
|
+
hide_cursor
|
12
|
+
move_to_top_left
|
13
|
+
yield
|
14
|
+
end
|
15
|
+
|
16
|
+
def stop
|
17
|
+
move_to_bottom
|
18
|
+
show_cursor
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def hide_cursor
|
23
|
+
print "\e[?25l"
|
24
|
+
end
|
25
|
+
|
26
|
+
def move_to_top_left
|
27
|
+
print "\e[H"
|
28
|
+
end
|
29
|
+
|
30
|
+
def show_cursor
|
31
|
+
print "\e[?25h"
|
32
|
+
end
|
33
|
+
|
34
|
+
def move_to_bottom
|
35
|
+
print "\e[2000E"
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smooth_terminal_print
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brett Sykes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Adds SmoothTerminalPrint.start and SmoothTerminalPrint.stop
|
14
|
+
email: brettcsykes@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/smooth_terminal_print.rb
|
20
|
+
homepage: https://github.com/bretts/smooth_terminal_print
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.5.0
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Allows the user to smoothly update printing to the terminal while in a tight
|
44
|
+
loop
|
45
|
+
test_files: []
|