문제

My .pryrc looks like this:

Pry.config.print = proc { |output, value| 
    output.puts "# => " + value.inspect ; puts 
}

Pry.config.prompt = [
  proc { "" },
  proc { "" }
]

Pry.config.prompt_name = 'my_project_name'

puts "# " + Time.now.strftime("%H:%M %d-%m-%Y")

and the results are returned with a # proceeding them, thus coderay ignores them and does not color them. I would like coderay to color them. There is info here: http://coderay.rubychan.de/doc/CodeRay/Encoders/CommentFilter.html

but I cannot figure it out. Any help is appreciated. If I figure it out, I will post solution.

EDIT: I would like things to be highlighted as if the # was not there (numbers one color, strings another and all, and multiple colors if, say, an array of diffrent things is returned), but even just making the whole returned line one color would be helpful for now. Thank you.

도움이 되었습니까?

해결책

Pry.config.print = proc { |output, value|
     output.puts '# => ' + CodeRay.scan(value, :ruby).encode(:terminal) ; puts 
}

Seems to do the trick!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top