mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Removed method missing from color module.
This commit is contained in:
@@ -47,12 +47,18 @@ module EdgeCase
|
|||||||
module Color
|
module Color
|
||||||
#shamelessly stolen from redgreen
|
#shamelessly stolen from redgreen
|
||||||
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36 }
|
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36 }
|
||||||
def self.method_missing(color_name, *args)
|
|
||||||
color(color_name) + args.first + color(:clear)
|
COLORS.each do |color, value|
|
||||||
end
|
class_eval "def self.#{color}(string); colorize(string, #{value}); end"
|
||||||
def self.color(color)
|
end
|
||||||
"\e[#{COLORS[color.to_sym]}m"
|
|
||||||
end
|
def self.colorize(string, color_value)
|
||||||
|
color(color_value) + string + color(COLORS[:clear])
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.color(color_value)
|
||||||
|
"\e[#{color_value}m"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Sensei
|
class Sensei
|
||||||
|
|||||||
Reference in New Issue
Block a user