2

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.

user2251284
  • 407
  • 2
  • 10
  • if the problem is the `#` then why don't you remove it? – Mike H-R May 12 '14 at 18:00
  • I want my returned values to be proceeded by a # (this provides consistency with commented return values, and makes copy-pasting back and forth easier/safer). But, I figured it out, see below. – user2251284 May 12 '14 at 18:10

1 Answers1

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

Seems to do the trick!

user2251284
  • 407
  • 2
  • 10