Commit graph

14 commits

Author SHA1 Message Date
Nobuyoshi Nakada
8680ae9cbd
irb: Removed unused variables 2020-12-20 19:36:24 +09:00
Nobuyoshi Nakada
feea436feb
irb: Define extension command only on the given object
Not to interfer in class variables.
2020-12-20 18:26:38 +09:00
Nobuyoshi Nakada
0fad9a9e30
Set non-verbose mode as well as tty mode 2020-12-20 17:15:02 +09:00
aycabta
59b84fbf2e Set :DEFAULT to PROMPT_MODE for CI 2020-12-20 17:07:24 +09:00
aycabta
216a087e93 Suppress errors related to using variables that are not directly related to testing 2020-12-20 16:48:47 +09:00
aycabta
9f08e3c703 [ruby/irb] Add measure command
You can use "measure" command to check performance in IRB like below:

  irb(main):001:0> 3
  => 3
  irb(main):002:0> measure
  TIME is added.
  => nil
  irb(main):003:0> 3
  processing time: 0.000058s
  => 3
  irb(main):004:0> measure :off
  => nil
  irb(main):005:0> 3
  => 3

You can set "measure :on" by "IRB.conf[:MEASURE] = true" in .irbrc, and, also,
set custom performance check method:

  IRB.conf[:MEASURE_PROC][:CUSTOM] = proc { |context, code, line_no, &block|
    time = Time.now
    result = block.()
    now = Time.now
    puts 'custom processing time: %fs' % (Time.now - time) if IRB.conf[:MEASURE]
    result
  }

3899eaf2e2
2020-12-20 16:23:59 +09:00
Kazuhiro NISHIYAMA
4314c05377
Fix typos 2020-05-09 14:22:04 +09:00
Yusuke Endoh
1084b679bd Restore the external and internal encodings of STDIN, STDOUT, and STDERR
IRB::ReadlineInputMethod#initialize changes them via IRB.set_encoding.
2020-05-08 00:19:54 +09:00
Yusuke Endoh
3b147c4213 test/irb/test_cmd.rb: clear IRB.@CONF on setup
It caches a path to .irbrc file, which has caused random failure:

```
  1) Failure:
TestIRB::ExtendCommand#test_irb_info_multiline [/home/mame/work/ruby/test/irb/test_cmd.rb:49]:
Expected /
        Ruby\sversion: .+\n
        IRB\sversion:\sirb .+\n
        InputMethod:\sReidlineInputMethod\swith\sReline .+ and .+\n
        \.irbrc\spath: .+
      /x to match "Ruby version: 2.8.0\n" +
"IRB version: irb 1.2.3 (2020-02-15)\n" +
"InputMethod: ReidlineInputMethod with Reline 0.1.4 and /tmp/test_reline_config_155659/.inputrc\n".
```
2020-05-08 00:15:01 +09:00
Nobuyoshi Nakada
4a8acf4625
[ruby/irb] Restore the default encodings
IRB::ReadlineInputMethod#initialize sets via IRB.set_encoding.
2020-04-30 22:54:42 +09:00
Nobuyoshi Nakada
9d1b272b01
[ruby/irb] Suppress messages switching inspect mode 2020-04-30 11:57:08 +09:00
Nobuyoshi Nakada
b3ce6fa099
[ruby/irb] Relaxed regexp for readline
Readline::VERSION may not be a single word, e.g EditLine wrapper
when linked with editline.
2020-04-30 11:44:22 +09:00
aycabta
3864fbc6d8 [ruby/irb] Check existence of rc files in irb_info command
cdbb9dfc9f
2020-04-29 19:13:14 +09:00
aycabta
98a346d065 [ruby/irb] Add irb_info command
a6fe58e916
2020-04-29 19:13:14 +09:00