term-colorizer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MThmYTdhNTY2Y2NkZjI2ZDE0NWIzMjY5NGQ0M2Y0OTNkMzdmMjQyYg==
4
+ Y2JiMWVhMjllYmIzYzM3NjdiMmQ1M2VhNTdlMjQ1OGQwYjY4ZDZiYw==
5
5
  data.tar.gz: !binary |-
6
- YTUxOGUzMWNhNjViNWZjNzE0NmFkNDFmNDI5ZTQzMTA1NDgwOWNjYg==
6
+ MTZlYTYzMTcxZDZmOWM3MmIzY2RlOGZlNGUyNGY2ZDQyZWY3YjA5Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OWExNDMyZDQ5YmVmMDBjNGYzYjBlMWJlNzk0MDhlNDNmNzQ0MzExM2JjMTMx
10
- NGFhZWFkZjBiMzk2ZmQwMmRlY2UyYzNlNDZhMzQ1NjhkZDQyNzRhNzg0ODFm
11
- OGRjYjY1NzAxZDE4ODI3OTA5MDlhZTBjNzUxOWY2YWVkNzg0MTM=
9
+ ZWQxYmIyYjBmYzBlZTQ1MDMwYzk2YjI5NGE3NDZjMDllZTY3MTU1MmE5NTY2
10
+ YmFiZTQ4ZDNiZTdiZWRjNjc2OWVkYjQxNzBlMGEzMDI1NmVmOWM1MjQzNTRk
11
+ YTY1ODkyOWNhMTNkOWJkM2IwNmIxOTIyYjU5MTQ1Y2I5YmViZjc=
12
12
  data.tar.gz: !binary |-
13
- ZTY2NmU1MTgyMTU0M2E2OWJjZjk2NTUyZWM2MTU1ZGJiY2FkODQyYWU0OTVj
14
- ZDZhYzQ0Y2FmMDYxYjFiZjYxOWMyZWMwYjUxYzU3OTUxYTZiNGIxMWRkZmQ1
15
- M2ZiZjczMjMzZTkzZDlhY2QyMmJjODgzYzk4NjgzYmE3YjQ5ZGM=
13
+ YWE5MmJhYmFkOTlmMTE1MjYxODY4Yzc2NTZiMWQzMTlhMDEzZDMyZDc4Mjlj
14
+ OGZlZDc2ZjY4N2FkZDhkOGY2OThiZDQ4ZDkyNTYwYzdiZDg3NmJiYjI4YWZh
15
+ YzAwM2RlYTI0Y2E2NDdkNWRkYmQ0MTdmY2UzMGJlZDY3NjEwYmI=
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
- ### 0.1.1 (Next Release)
1
+ ### 0.1.2 (Next Release)
2
2
 
3
3
  * Your contribution here.
4
4
 
5
+ ### 0.1.1 (7/13/2013)
6
+
7
+ * Logic changed to dynamically define and call the color methods on strings - [@vishaltelangre](https://github.com/vishaltelangre).
8
+
5
9
  ### 0.1.0 (7/13/2013)
6
10
 
7
11
  * Initial public release - [@vishaltelangre](https://github.com/vishaltelangre).
data/README.md CHANGED
@@ -7,6 +7,18 @@ Print colorized strings on terminal (Useful for printing fancy logs)
7
7
 
8
8
  ## Usage
9
9
 
10
+ Install gem by using following command:
11
+
12
+ gem install term-colorizer
13
+
14
+ or add it to your Gemfile as:
15
+
16
+ ```ruby
17
+ gem "term-colorizer"
18
+ ```
19
+
20
+ and use it as:
21
+
10
22
  ``` ruby
11
23
  "Duck can quack".green
12
24
  # => "\e[32mDuck can quack\e[0m"
@@ -9,28 +9,26 @@ module Term
9
9
  def method_missing(sym, *args, &block)
10
10
  method = sym.to_s
11
11
  super unless TERM_COLORS.include? method
12
- self.send(method)
13
- end
14
-
15
- TERM_COLORS.each do |color|
16
- case color
17
- when "black" then define_method("black") { "\e[30m" + self.to_s + "\e[0m" }
18
- when "red" then define_method("red") { "\e[31m" + self.to_s + "\e[0m" }
19
- when "green" then define_method("green") { "\e[32m" + self.to_s + "\e[0m" }
20
- when "yellow" then define_method("yellow") { "\e[33m" + self.to_s + "\e[0m" }
21
- when "blue" then define_method("blue") { "\e[34m" + self.to_s + "\e[0m" }
22
- when "magenta" then define_method("magenta") { "\e[35m" + self.to_s + "\e[0m" }
23
- when "cyan" then define_method("cyan") { "\e[36m" + self.to_s + "\e[0m" }
24
- when "white" then define_method("white") { "\e[37m" + self.to_s + "\e[0m" }
25
- when "bright_black" then define_method("bright_black") { "\e[1m\e[30m" + self.to_s + "\e[0m" }
26
- when "bright_red" then define_method("bright_red") { "\e[1m\e[31m" + self.to_s + "\e[0m" }
27
- when "bright_green" then define_method("bright_green") { "\e[1m\e[32m" + self.to_s + "\e[0m" }
28
- when "bright_yellow" then define_method("bright_yellow") { "\e[1m\e[33m" + self.to_s + "\e[0m" }
29
- when "bright_blue" then define_method("bright_blue") { "\e[1m\e[34m" + self.to_s + "\e[0m" }
30
- when "bright_magenta" then define_method("bright_magenta") { "\e[1m\e[35m" + self.to_s + "\e[0m" }
31
- when "bright_cyan" then define_method("bright_cyan") { "\e[1m\e[36m" + self.to_s + "\e[0m" }
32
- when "bright_white" then define_method("bright_white") { "\e[1m\e[37m" + self.to_s + "\e[0m" }
33
- end
12
+ self.class.send(:define_method, method) do
13
+ case method
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
31
+ end and self.send(method, *args)
34
32
  end
35
33
  end
36
34
  end
@@ -1,5 +1,5 @@
1
1
  module Term
2
2
  module Colorizer
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-colorizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Telangre
@@ -56,4 +56,3 @@ signing_key:
56
56
  specification_version: 4
57
57
  summary: Print colorized strings on terminal (Useful for printing fancy logs)
58
58
  test_files: []
59
- has_rdoc: