How to suppress the output of return value in IRB/Rails Console?

后端 未结 4 1819
别那么骄傲
别那么骄傲 2020-12-23 20:29

An example is if I go into IRB and do the following:

jruby-1.6.7 :026 > puts [1,2,3,4,5]
1
2
3
4
5
=> nil 

Is there anyway to suppres

4条回答
  •  礼貌的吻别
    2020-12-23 21:13

    You can also supress the output with the following command as irb --simple-prompt --noecho.

    Find the below:

    @ubuntu:~$ irb --simple-prompt
    >> puts "hi"
    hi
    => nil
    >> p "hi"
    "hi"
    => "hi"
    >> exit
    @ubuntu:~$ irb --simple-prompt --noecho
    >> puts "hi"
    hi
    >> p "hi"
    "hi"
    >> 
    

    Hope you will be fine with it.

    I am using ruby version as below :

    @ubuntu:~$ ruby -v
    ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
    

提交回复
热议问题