simple-ansi 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/Rakefile +1 -1
- data/lib/simple/ansi.rb +7 -10
- data/lib/simple/ansi/version.rb +5 -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: 2adc5233ee50e1a9622386e4c6f6db5a0b799f40
|
4
|
+
data.tar.gz: fc03232a607ba2c4ea1c045a9f80f2ed6851308d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f53708c4e1a95dd9917842f2274bc3dd88263b46587eb5fce7b8bc9a6ef647411a8ad85cc7c62f676ba6b3ebdfa04d5dbb47364e58260fa5d2d144f95951da5d
|
7
|
+
data.tar.gz: 04cdc8746e9ed7579973d780c45e29efdae9670ba5f37d8e4ea88f34263d6b4515bb9aebc2e690cf37228a31a94c5bd0d8d9774834762f2d197802fd7aa7f522
|
data/Gemfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2015-2016 Jordon Bedwell -
|
2
|
+
# Copyright: 2015-2016 Jordon Bedwell - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
5
|
source "https://rubygems.org"
|
@@ -12,8 +12,7 @@ end
|
|
12
12
|
|
13
13
|
group :development do
|
14
14
|
gem "rspec", :require => false
|
15
|
-
gem "
|
16
|
-
gem "benchmark-ips", :require => false
|
15
|
+
gem "rspec-helpers", :require => false
|
17
16
|
gem "luna-rspec-formatters", :require => false
|
18
17
|
gem "pry", :require => false
|
19
18
|
end
|
data/Rakefile
CHANGED
data/lib/simple/ansi.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2015-2016 Jordon Bedwell -
|
2
|
+
# Copyright: 2015-2016 Jordon Bedwell - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
5
|
module Simple
|
6
6
|
module Ansi
|
7
7
|
extend self
|
8
8
|
|
9
|
-
ANSI_MATCH =
|
10
|
-
# This tries to match the many types of Ansi's out there, there are more though.
|
11
|
-
|
9
|
+
ANSI_MATCH = /\x1b.*?[jkmsuABGKH]/
|
12
10
|
COLORS = {
|
13
11
|
:red => 31,
|
14
12
|
:green => 32,
|
@@ -29,7 +27,7 @@ module Simple
|
|
29
27
|
#
|
30
28
|
|
31
29
|
def clear
|
32
|
-
$stdout.print
|
30
|
+
$stdout.print "\x1b[H\x1b[2J"
|
33
31
|
end
|
34
32
|
|
35
33
|
#
|
@@ -43,27 +41,26 @@ module Simple
|
|
43
41
|
# way that Docker does them in an async way without breaking term.
|
44
42
|
|
45
43
|
def jump(str, num)
|
46
|
-
|
47
|
-
clear_line(str), 27, num)
|
44
|
+
"\x1b[#{num}A#{clear_line(str)}\x1b[#{num}B"
|
48
45
|
end
|
49
46
|
|
50
47
|
#
|
51
48
|
|
52
49
|
def reset(str = "")
|
53
|
-
"
|
50
|
+
"\x1b[0m#{str}"
|
54
51
|
end
|
55
52
|
|
56
53
|
#
|
57
54
|
|
58
55
|
def clear_line(str = "")
|
59
|
-
"
|
56
|
+
"\x1b[2K\r#{str}\r"
|
60
57
|
end
|
61
58
|
|
62
59
|
#
|
63
60
|
|
64
61
|
COLORS.each do |color, num|
|
65
62
|
define_method color do |str|
|
66
|
-
"
|
63
|
+
"\x1b[#{num}m#{str}#{reset}"
|
67
64
|
end; module_function color
|
68
65
|
end
|
69
66
|
end
|
data/lib/simple/ansi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-ansi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple ansi library that does only what it needs to do.
|
14
14
|
email:
|