majic 0.1

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.
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ class String
4
+ def ansi_escape code
5
+ ANSIEscape[code] + self + ANSIEscape[]
6
+ end
7
+
8
+ alias_method :^, :ansi_escape
9
+ end
10
+
11
+ module ANSIEscape
12
+ Codes = {
13
+ :bold => '1',
14
+ :reset => '0;0',
15
+ :black => '0;30',
16
+ :red => '0;31',
17
+ :green => '0;32',
18
+ :brown => '0;33',
19
+ :blue => '0;34',
20
+ :cyan => '0;36',
21
+ :purple => '0;35',
22
+ :light_gray => '0;37',
23
+ :dark_gray => '1;30',
24
+ :light_red => '1;31',
25
+ :light_green => '1;32',
26
+ :yellow => '1;33',
27
+ :light_blue => '1;34',
28
+ :light_cyan => '1;36',
29
+ :light_purple => '1;35',
30
+ :white => '1;37',
31
+ } unless defined? Codes
32
+
33
+ def self.[] code = :reset
34
+ (sequence = Codes[code]) ? "\033[#{sequence}m" : %%%
35
+ end
36
+ end
data/library/majic.rb ADDED
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'majic/ansi_escape'
4
+
5
+ module Majic
6
+ class << Version = [0,1]
7
+ def to_s; join '.' end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: majic
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: ruby
7
+ authors:
8
+ - Mikkel Kroman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-02-04 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description:
18
+ email: mk@maero.dk
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - library/majic.rb
27
+ - library/majic/ansi_escape.rb
28
+ has_rdoc: true
29
+ homepage:
30
+ licenses: []
31
+
32
+ post_install_message:
33
+ rdoc_options: []
34
+
35
+ require_paths:
36
+ - library
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.9.1
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ requirements: []
50
+
51
+ rubyforge_project:
52
+ rubygems_version: 1.5.0
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: A set of utillities for Ruby
56
+ test_files: []
57
+