diff options
| author | Tom Black <[email protected]> | 2018-10-16 23:24:18 -0700 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-10-16 23:24:18 -0700 |
| commit | 1b646f82c67e7c38df08113bcc3323c7aaf4639f (patch) | |
| tree | d932a3d054ceba5ce5be69e42453998787cf4d9f /lib | |
| parent | a4a7e23038e26ecc63d94b5e815c36dff2ffb433 (diff) | |
| download | ruby2d-1b646f82c67e7c38df08113bcc3323c7aaf4639f.tar.gz ruby2d-1b646f82c67e7c38df08113bcc3323c7aaf4639f.zip | |
Move `String#colorize` to a separate file to require
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d.rb | 3 | ||||
| -rw-r--r-- | lib/ruby2d/colorize.rb | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/ruby2d.rb b/lib/ruby2d.rb index 58a69da..2471888 100644 --- a/lib/ruby2d.rb +++ b/lib/ruby2d.rb @@ -1,7 +1,8 @@ # Ruby2D module and native extension loader, adds DSL -require 'ruby2d/renderable' +require 'ruby2d/colorize' require 'ruby2d/exceptions' +require 'ruby2d/renderable' require 'ruby2d/color' require 'ruby2d/window' require 'ruby2d/dsl' diff --git a/lib/ruby2d/colorize.rb b/lib/ruby2d/colorize.rb new file mode 100644 index 0000000..856ecb8 --- /dev/null +++ b/lib/ruby2d/colorize.rb @@ -0,0 +1,10 @@ +# String#colorize + +# Extend `String` to include some fancy colors +class String + def colorize(c); "\e[#{c}m#{self}\e[0m" end + def bold; colorize('1') end + def info; colorize('1;34') end + def warn; colorize('1;33') end + def error; colorize('1;31') end +end |
