diff options
| author | Tom Black <[email protected]> | 2020-01-01 23:47:48 -0600 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2020-01-01 23:47:48 -0600 |
| commit | 3bfe72034fae46d8184ad02c63268f99e2ff69fe (patch) | |
| tree | 6eb358765f20ab5f76eae8b0e2f750381daddd5a | |
| parent | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 (diff) | |
| download | ruby2d-3bfe72034fae46d8184ad02c63268f99e2ff69fe.tar.gz ruby2d-3bfe72034fae46d8184ad02c63268f99e2ff69fe.zip | |
`colorize` fixes
Move to the `cli` directory, rename `colorize` method to avoid naming conflicts with other gems
| -rw-r--r-- | Rakefile | 2 | ||||
| -rw-r--r-- | ext/ruby2d/extconf.rb | 2 | ||||
| -rw-r--r-- | lib/ruby2d.rb | 2 | ||||
| -rw-r--r-- | lib/ruby2d/cli/colorize.rb | 10 | ||||
| -rw-r--r-- | lib/ruby2d/colorize.rb | 10 |
5 files changed, 13 insertions, 13 deletions
@@ -1,5 +1,5 @@ require 'rspec/core/rake_task' -require_relative 'lib/ruby2d/colorize' +require_relative 'lib/ruby2d/cli/colorize' require_relative 'lib/ruby2d/version' def get_args diff --git a/ext/ruby2d/extconf.rb b/ext/ruby2d/extconf.rb index a058519..0689543 100644 --- a/ext/ruby2d/extconf.rb +++ b/ext/ruby2d/extconf.rb @@ -1,5 +1,5 @@ require 'mkmf' -require_relative '../../lib/ruby2d/colorize' +require_relative '../../lib/ruby2d/cli/colorize' S2D_VERSION = '1.1.0' # Simple 2D minimum version required $errors = [] # Holds errors diff --git a/lib/ruby2d.rb b/lib/ruby2d.rb index c03560d..3fb8721 100644 --- a/lib/ruby2d.rb +++ b/lib/ruby2d.rb @@ -1,7 +1,7 @@ # Ruby2D module and native extension loader, adds DSL unless RUBY_ENGINE == 'mruby' - require 'ruby2d/colorize' + require 'ruby2d/cli/colorize' require 'ruby2d/exceptions' require 'ruby2d/renderable' require 'ruby2d/color' diff --git a/lib/ruby2d/cli/colorize.rb b/lib/ruby2d/cli/colorize.rb new file mode 100644 index 0000000..68082cb --- /dev/null +++ b/lib/ruby2d/cli/colorize.rb @@ -0,0 +1,10 @@ +# String#ruby2d_colorize + +# Extend `String` to include some fancy colors +class String + def ruby2d_colorize(c); "\e[#{c}m#{self}\e[0m" end + def bold; ruby2d_colorize('1') end + def info; ruby2d_colorize('1;34') end + def warn; ruby2d_colorize('1;33') end + def error; ruby2d_colorize('1;31') end +end diff --git a/lib/ruby2d/colorize.rb b/lib/ruby2d/colorize.rb deleted file mode 100644 index 856ecb8..0000000 --- a/lib/ruby2d/colorize.rb +++ /dev/null @@ -1,10 +0,0 @@ -# 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 |
