Skip to content

Instantly share code, notes, and snippets.

@satoyos
Created May 6, 2013 11:07
Show Gist options
  • Select an option

  • Save satoyos/5524538 to your computer and use it in GitHub Desktop.

Select an option

Save satoyos/5524538 to your computer and use it in GitHub Desktop.
RSpecがcmd.exeのコンソール画面に出力する 赤と緑を明るくするためのモンキーパッチ。 9行目で、コードポイント化された残念なUTF-8文字列を 助けるフィルタリングメソッドを使ってtextを変換している。
require 'rspec/core/formatters/base_text_formatter'
require_relative 'handle_pointed_utf_str'
# RSpecがcmd.exeのコンソール画面に出力する赤と緑を明るくするために、オーバーライド。
class RSpec::Core::Formatters::BaseTextFormatter
protected
def colorize(text, code_or_symbol)
text = Handle_uXXXX.correct_point_coded_str(text)
# "\e[#{color_code_for(code_or_symbol)}m#{text}\e[0m"
"\e[1;#{color_code_for(code_or_symbol)}m#{text}\e[0m"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment