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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1548d2475544c03d3f186b884d0310ec86704415
4
- data.tar.gz: eb01d62e6c6fc4f94ca2db7cfd039d31b6217464
3
+ metadata.gz: 2adc5233ee50e1a9622386e4c6f6db5a0b799f40
4
+ data.tar.gz: fc03232a607ba2c4ea1c045a9f80f2ed6851308d
5
5
  SHA512:
6
- metadata.gz: dd43a1838cdc40cc44aec0e8071fbc9350928fbc301982a07441d0e10edaab4d3dd994c3046ea6c2d95dbc9387501c5b59d0b26292460fe84cf734507a7628ca
7
- data.tar.gz: 1905d770b851830e8c82a654eb19aee55c3c8917e06220667b1ac18d7699c2f6b37ff31d0aa684d857fc635bd88175ec41ad47e5ee171b7fcbf8a95c05538ce2
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 - Apache v2.0 License
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 "guard-rspec", :require => false
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
@@ -1,5 +1,5 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2015 Jordon Bedwell - Apache v2.0 License
2
+ # Copyright: 2015-2016 Jordon Bedwell - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
5
  $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
@@ -1,14 +1,12 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2015-2016 Jordon Bedwell - Apache v2.0 License
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 = /#{format("%c", 27)}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix.freeze
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(format("%c[H%c[2J", 27, 27))
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
- format("%c[%dA%s%c[%dB", 27, num, \
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
- "#{format("%c[0m", 27)}#{str}"
50
+ "\x1b[0m#{str}"
54
51
  end
55
52
 
56
53
  #
57
54
 
58
55
  def clear_line(str = "")
59
- "#{format("%c[2K\r", 27)}#{str}\r"
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
- "#{format("%c", 27)}[#{num}m#{str}#{reset}"
63
+ "\x1b[#{num}m#{str}#{reset}"
67
64
  end; module_function color
68
65
  end
69
66
  end
@@ -1,5 +1,9 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2015-2016 Jordon Bedwell - MIT License
3
+ # Encoding: utf-8
4
+
1
5
  module Simple
2
6
  module Ansi
3
- VERSION = "1.0.0"
7
+ VERSION = "1.0.2"
4
8
  end
5
9
  end
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.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-03 00:00:00.000000000 Z
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: