문제

I was able to customize the prompt for Pry with the Pry.config.prompt setting in ~/.pryrc in order to make Pry simpler for kids. Now I want to get rid of the return output:

Enter Ruby code> puts 'hello'
hello
=> nil
Enter Ruby code> 

The => nil is confusing for a kid just learning to program. Can I suppress the return value output in Pry?

도움이 되었습니까?

해결책

There are a few ways to do it. Either add ; to the end of each line or replace the default Pry.config.print with a proc of your own. For example, adding something like

Pry.config.print = Proc.new { |output, value| }

to your ~/.pryrc should do the trick.

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