colorizr 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/colorizr.rb +33 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 94d8535ca01afbcfb3202284d7b33ec9b1041212
4
+ data.tar.gz: cc84f3f6406e03250622f9abbcfaa9a171cb798e
5
+ SHA512:
6
+ metadata.gz: f93507031be09fef56a9a5ceefd7dc7a8d3dd697be50128eca4fbfafd379af73c03a3706a0632eec6adad1d778a4afb5866dc9c96ade04ae7bf6af242fe33104
7
+ data.tar.gz: 0ea51472f6caf31f4b6a3e26262719214222635fb82bf2ad78a83e542ffe13c406f0324cfd39d1e2ca71e36e9f00ec84ce88bb57ea14ffa49f5129e0997e01e8
data/lib/colorizr.rb ADDED
@@ -0,0 +1,33 @@
1
+ class String
2
+ def self.colors
3
+ color_hash.keys
4
+ end
5
+ def self.create_colors
6
+ colors.each do |color|
7
+ send(:define_method, "#{color}") do
8
+ "\e[#{String.color_hash()[color]}m#{self}\e[0m"
9
+ end
10
+ end
11
+ end
12
+ def self.sample_colors
13
+ colors.each do |color|
14
+ puts "This is #{color.to_s.send color}"
15
+ end
16
+ end
17
+ private
18
+ def self.color_hash
19
+ {
20
+ red: 31,
21
+ green: 32,
22
+ yellow: 33,
23
+ blue: 34,
24
+ pink: 35,
25
+ light_blue: 94,
26
+ white: 97,
27
+ light_grey: 37,
28
+ black: 30
29
+ }
30
+ end
31
+ end
32
+ String.create_colors
33
+
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: colorizr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kishan B
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple gem to colorize terminal output
14
+ email: kishancs46@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/colorizr.rb
20
+ homepage: https://github.com/kishaningithub/colorizr
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Colors Everywhere!
44
+ test_files: []