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