term-colorizer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +5 -1
- data/lib/term-colorizer/colorizer.rb +21 -26
- data/lib/term-colorizer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmIyYTkwODI1YTNhZWQ5ZmZmYTNiYzU1YWJjZDY0N2ExYWQxNDdjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWFjN2JjNjRhZGViOTczYjRjNDdlMGVmOGNiNTMwZjNhNzg3ZjZlMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjE0MGY3MjQzNjdiODI0NTZmOWQ0N2U4ZTZlMmU3M2M5MDY3NmIwNzNhMzQ1
|
10
|
+
NjMyMzEyNDI5NzE4OTk2YmM3YmUwMjdlZGI5NDgwMThjOTFmODM2YjljYTMz
|
11
|
+
NDcyZTAzZDYwNzA4ODIyNTBiYThmZjE4MTFjM2E5MmE4NDIxNzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWI4MzU3M2M3NDk3MTNmYjUyODIxMzg5OGFmYTk0M2ViZThkNWEwMDI5YmJh
|
14
|
+
ODg5YzUxYjg2ODk3ODMwYmZiNDkyZDEyOWY2N2QxMGUxNTI2MWM3OTJkNTY2
|
15
|
+
MGNiMjAzOTAzMjY4ZTBhOGEzNTA5MGFhZDIwYWI3YjQ4NTBiYTU=
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
### 0.1.
|
1
|
+
### 0.1.3 (Next Release)
|
2
2
|
|
3
3
|
* Your contribution here.
|
4
4
|
|
5
|
+
### 0.1.2 (7/22/2013)
|
6
|
+
|
7
|
+
* Created a hash for terminal color, and used it inside method_missing to define color methods on the fly when called. - [@vishaltelangre](https://github.com/vishaltelangre).
|
8
|
+
|
5
9
|
### 0.1.1 (7/13/2013)
|
6
10
|
|
7
11
|
* Logic changed to dynamically define and call the color methods on strings - [@vishaltelangre](https://github.com/vishaltelangre).
|
@@ -1,33 +1,28 @@
|
|
1
1
|
module Term
|
2
2
|
module Colorizer
|
3
|
-
TERM_COLORS =
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
TERM_COLORS = {
|
4
|
+
:black => "\e[30mSTR\e[0m",
|
5
|
+
:red => "\e[31mSTR\e[0m",
|
6
|
+
:green => "\e[32mSTR\e[0m",
|
7
|
+
:yellow => "\e[33mSTR\e[0m",
|
8
|
+
:blue => "\e[34mSTR\e[0m",
|
9
|
+
:magenta => "\e[35mSTR\e[0m",
|
10
|
+
:cyan => "\e[36mSTR\e[0m",
|
11
|
+
:white => "\e[37mSTR\e[0m",
|
12
|
+
:bright_black => "\e[1m\e[30mSTR\e[0m",
|
13
|
+
:bright_red => "\e[1m\e[31mSTR\e[0m",
|
14
|
+
:bright_green => "\e[1m\e[32mSTR\e[0m",
|
15
|
+
:bright_yellow => "\e[1m\e[33mSTR\e[0m",
|
16
|
+
:bright_blue => "\e[1m\e[34mSTR\e[0m",
|
17
|
+
:bright_magenta => "\e[1m\e[35mSTR\e[0m",
|
18
|
+
:bright_cyan => "\e[1m\e[36mSTR\e[0m",
|
19
|
+
:bright_white => "\e[1m\e[37mSTR\e[0m"
|
20
|
+
}
|
8
21
|
|
9
|
-
def method_missing(
|
10
|
-
|
11
|
-
super unless TERM_COLORS.include? method
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
super unless TERM_COLORS.keys.include? method
|
12
24
|
self.class.send(:define_method, method) do
|
13
|
-
|
14
|
-
when "black" then "\e[30m" + self.to_s + "\e[0m"
|
15
|
-
when "red" then "\e[31m" + self.to_s + "\e[0m"
|
16
|
-
when "green" then "\e[32m" + self.to_s + "\e[0m"
|
17
|
-
when "yellow" then "\e[33m" + self.to_s + "\e[0m"
|
18
|
-
when "blue" then "\e[34m" + self.to_s + "\e[0m"
|
19
|
-
when "magenta" then "\e[35m" + self.to_s + "\e[0m"
|
20
|
-
when "cyan" then "\e[36m" + self.to_s + "\e[0m"
|
21
|
-
when "white" then "\e[37m" + self.to_s + "\e[0m"
|
22
|
-
when "bright_black" then "\e[1m\e[30m" + self.to_s + "\e[0m"
|
23
|
-
when "bright_red" then "\e[1m\e[31m" + self.to_s + "\e[0m"
|
24
|
-
when "bright_green" then "\e[1m\e[32m" + self.to_s + "\e[0m"
|
25
|
-
when "bright_yellow" then "\e[1m\e[33m" + self.to_s + "\e[0m"
|
26
|
-
when "bright_blue" then "\e[1m\e[34m" + self.to_s + "\e[0m"
|
27
|
-
when "bright_magenta" then "\e[1m\e[35m" + self.to_s + "\e[0m"
|
28
|
-
when "bright_cyan" then "\e[1m\e[36m" + self.to_s + "\e[0m"
|
29
|
-
when "bright_white" then "\e[1m\e[37m" + self.to_s + "\e[0m"
|
30
|
-
end
|
25
|
+
TERM_COLORS[method].sub(/STR/, self.to_s)
|
31
26
|
end and self.send(method, *args)
|
32
27
|
end
|
33
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: term-colorizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vishal Telangre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: the@vishaltelangre.com
|