the_great_escape 0.1.0 → 0.1.03
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +9 -13
- data/lib/the_great_escape/escaper.rb +1 -1
- data/lib/the_great_escape/version.rb +1 -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: 7e75689468950eda885a5aed37c8fc56cd1f40cd
|
4
|
+
data.tar.gz: 6ca487bc62ee3a9e50b3c7c1d9cce02a4a652a34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a020e8b4f6f89dc1ad27234f210bcbb550a83aa365957f56c08962c8a04d254df09b26a2ba714a313768099c709201f604c48fa830489941a8c98d2afc3a77aa
|
7
|
+
data.tar.gz: 96193a1b0ceefe7dd067eeb660b40247a3d5d37165b5666347499723c72a53fec8c3f2650f6e9f3c9d7a7415d35c644c05fa721baaa6878094437ad7ed24f2a6
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,28 +2,24 @@
|
|
2
2
|
My first gem, the great escape. Seeing if your string contains SGR or other ASCII codes can be tricky, as when you print them to the screen they change the color/formatting of your terminal whether you want them to our not! Dumping results in more characters you have to either escape or sift through by eye. All the_great_escape does is escape strings that contain special sequences such as SGR parameters.
|
3
3
|
|
4
4
|
# Installation
|
5
|
-
|
6
|
-
|
5
|
+
* Add this line to your application's Gemfile:
|
7
6
|
```ruby
|
8
7
|
gem 'the_great_escape'
|
9
8
|
```
|
10
|
-
|
11
|
-
1. cd into your project's root:
|
9
|
+
* cd into your project's root:
|
12
10
|
```
|
13
11
|
$ cd my_project
|
14
12
|
```
|
15
|
-
|
13
|
+
* execute:
|
16
14
|
```
|
17
15
|
$ bundle install
|
18
16
|
```
|
19
17
|
## Usage
|
20
|
-
|
21
|
-
1. Require the_great_escape at the top of the file
|
18
|
+
* Require the_great_escape at the top of the file
|
22
19
|
```ruby
|
23
20
|
require 'the_great_escape'
|
24
21
|
```
|
25
|
-
|
26
|
-
1. And now use!
|
22
|
+
* And now use!
|
27
23
|
```ruby
|
28
24
|
require 'the_great_escape'
|
29
25
|
|
@@ -47,10 +43,10 @@ puts string.scan /\\e\[\d+m$/ # ["\\e[31m"] scan returns the SGR code at the end
|
|
47
43
|
puts "\e[0" # reset your terminal to its default style if you run this code.
|
48
44
|
```
|
49
45
|
## Methods:
|
50
|
-
Method
|
51
|
-
|
52
|
-
escape
|
53
|
-
|
46
|
+
| Method | Example Usage | Description |
|
47
|
+
| ------------- | ---------------------- | --- |
|
48
|
+
| escape STRING | escaped = escape "hell \e[31m" | escapes the string passed to it so it can be safely printed later. Does not invalidate the string |
|
49
|
+
| escape_puts STRING | escape_puts "hell \e[31m" | escapes the string passed to it and prints it immediately to the console |
|
54
50
|
|
55
51
|
# Contributing
|
56
52
|
Okay, I'm pretty new to Ruby and utterly new to git so I've created this to learn about string escapement, git collaboration and how to package, release and install gems. Regardless, to contribute:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_great_escape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.03
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jaytarka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|