c32 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/c32.rb +49 -0
  5. metadata +71 -0
  6. metadata.gz.sig +0 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f4b94f0bd71caba2b78e45120a5f14f9379c7440bc8b724c24f655f4135aa4d2
4
+ data.tar.gz: 85a58de545fbcbd55c0e1396b588a0be9e37047a8eea1a1abc07027f36421b34
5
+ SHA512:
6
+ metadata.gz: 53b6b726d127e29f5eccf3168c6c60ed6850ac354361ea7cd7472995bfe4a8cb31ba4448667b02f8e3978debfa4a0deb368eebb1799f66a53cfade43490d5fec
7
+ data.tar.gz: 76ca2e3f8c2db4f94114dfb192400d9ccdc63a91ca04f8802483c98dfb57f00ce5d984c9141411514986d09d6a43d52c0448e6db14830ef6fdb2ed34af3e63fa
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: c32.rb
4
+
5
+
6
+ module ColouredText
7
+ refine String do
8
+
9
+ colours = %i(black red green brown blue magenta cyan gray)
10
+ colours.each.with_index {|c,i| define_method(c){ colorize(30+i)}}
11
+ bg_colours = colours.map {|c| ('bg_' + c.to_s).to_sym}
12
+ bg_colours.each.with_index {|c,i| define_method(c){ colorize(40+i)}}
13
+
14
+ def debug()
15
+ "debug: ".green + self
16
+ end
17
+
18
+ def warn()
19
+ "warning: ".brown + Time.now.strftime("%H:%M:%S").gray + ' ' + self
20
+ end
21
+
22
+ alias warning warn
23
+
24
+ def error()
25
+ "error: ".red + Time.now.strftime("%Y-%b-%d %H:%M").gray + ' ' + self
26
+ end
27
+
28
+ alias err error
29
+
30
+ def bold()
31
+ "\e[1m#{self}\e[22m"
32
+ end
33
+
34
+ def info()
35
+ "info: ".bold + self
36
+ end
37
+
38
+ def highlight()
39
+ self.brown.bold
40
+ end
41
+
42
+ private
43
+
44
+ def colorize(color_code)
45
+ "\e[#{color_code}m#{self}\e[0m"
46
+ end
47
+
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c32
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgxMTAzMTYwMTIzWhcN
15
+ MTkxMTAzMTYwMTIzWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC++5d9
17
+ 3L/+VcKAgXT8VGoW7hguA1+1DjinUITDllUovlh02zHsTgjm73wDgimeXsQto0Q7
18
+ CQui++IOorLKoWWpFEyfsNA4iCslanpsXLid5Ad6/avl8VDD/kPHDl6h3ciYyyjG
19
+ 8NNz/1th6eLHaxXtbzzwovwelQ4myzeqo0W2QBi82c/LZAMlqX51HgiytNYIwfA+
20
+ eaE2rOuWyhVwVSZQBYxQcZGjxBKO4oZYKs4/ny2BP1iWes7TlhWoIf+/MJQ/t1oI
21
+ K3DY90Z6ZCkMoOxPPBaVTRMwlyGpzF4FPl4j5InbIOSjjnzkX2asl8/rle/X0cPV
22
+ GkC2Cq4kTdfanNqPFi2pSHVeRnzlvHsnPT4NgP59wa9xuOrGuU9EyQSrBc5/AOFk
23
+ P2FeghgwPkKMG216LXSg9O39aQL7323q4p7V9MAPZ7/QtotA254Y/w8DoO5phiUf
24
+ znqcV2WAF2WV59H86gvI2j+yxcJaA2WQEu0Q2PL9q+2WMzUaPML+vR9loF0CAwEA
25
+ AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUsH+7dRlf
26
+ y/CsVA9vtqhYNquTYYowJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
27
+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAMJ6+EfUcEL9zZ5SfgQubII2f7YtsVljpumSW3yfM
29
+ zHtC6dzVcH9/PuI0/f1dbtT86e4CxNLqJ4p93/LdlXix1vpOd/CWjMC3U7RpRxLU
30
+ 49MAyhDRbl9j50Yb+Ozo8+ERs6V1dEeBYyz4b/rRD4OUZj6Ep34UrFkhs7V5Fqdn
31
+ b6dzDXHYbrl6K3mYlFauBYJJsaqgfeCoh3wBE6P5hS1JGC/giqymMUM3dVs/RiJI
32
+ c9L1hp7FqIj8h1sUZUYEzkLa5SF/wOcMd1xiZ4y2MF4qGmf1tGgZS6wRew21oRsz
33
+ pNQ6ZmEAQSmzTOKE1zBIU/KXhbXS+S5i8aG3eeNNRNpaBJzYZkhSc3PO5a1PFk1l
34
+ 1yaDumxa9AJs6habOoJHgL+jyPanie5+NLV6lBNohgI+lx/JAFTcZxS+lstfBgaj
35
+ lxOOmIngL7E/QH/hAd3I35TI6ddGk9WuqQjXr6Wd8nA/9WqCCF/5F3FyKfJVvF2b
36
+ nwOv+LDi2NDDbJyXte8gtAi6
37
+ -----END CERTIFICATE-----
38
+ date: 2018-11-03 00:00:00.000000000 Z
39
+ dependencies: []
40
+ description:
41
+ email: james@jamesrobertson.eu
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - lib/c32.rb
47
+ homepage: https://github.com/jrobertson/c32
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.7.6
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Makes it easier to read debug messages using coloured text.
71
+ test_files: []
Binary file