Граф коммитов

112 Коммитов

Автор SHA1 Сообщение Дата
Nobuhiro IMAI 4bb683a570 [ruby/irb] fix typo in `IRB::Irb#convert_invalid_byte_sequence`
https://github.com/ruby/irb/commit/d09d3c3d68
2021-01-08 13:25:18 +09:00
aycabta e72a6ed45f [ruby/irb] Escape invalid byte sequence in Exception
This fixes ruby/irb#141.

https://github.com/ruby/irb/commit/0815317d42
2021-01-05 18:05:06 +09:00
aycabta 4131cd05be [ruby/irb] Support arg for measure command
https://github.com/ruby/irb/commit/b43f35d8f3
2020-12-22 23:45:43 +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
  }

https://github.com/ruby/irb/commit/3899eaf2e2
2020-12-20 16:23:59 +09:00
aycabta 2d112c346a [ruby/irb] Stop using bang version for #inspect of result
https://github.com/ruby/irb/commit/fc1426d34e
2020-11-22 21:00:11 +09:00
Andrew Kerr ef3c25888e Fix small typo in comment in lib/irb.c 2020-10-22 10:56:35 -07:00
aycabta 555ea83344 [ruby/irb] Drop OMIT_ON_ASSIGNMENT and add :truncate option for ECHO_ON_ASSIGNMENT
https://github.com/ruby/irb/commit/4c89b0775b
2020-09-19 05:13:08 +09:00
aycabta 8f9b1902f4 [ruby/irb] Omit output if first line of multiline is too long
https://github.com/ruby/irb/commit/0feeae38c5
2020-09-14 02:13:18 +09:00
aycabta e468d9f49c [ruby/irb] Add OMIT_ON_ASSIGNMENT
Omit the results evaluated at assignment if they are too long.

The behavior of ECHO_ON_ASSIGNMENT being on by default is hard to understand,
so I change it to off by default. Instead, we turn OMIT_ON_ASSIGNMENT on by
default. The result is displayed on assignment, but it will always be short
and within one line of the screen.

https://github.com/ruby/irb/commit/c5ea79d5ce
2020-09-14 02:13:11 +09:00
Nobuyoshi Nakada d32229e338 [ruby/irb] Prefer require_relative to load the files in this library
https://github.com/ruby/irb/commit/0ac3bc7296
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada bc646e6715
[DOC] get rid of parsing as TIDYLINK unintentionally 2020-04-07 13:59:38 +09:00
aycabta 22477128cd [ruby/irb] Suppress crashing when EncodingError has occurred without lineno
https://github.com/ruby/irb/commit/13572d8cdc
2020-03-26 17:41:21 +09:00
aycabta ffbb162f1a [ruby/irb] Detect multiple lines output simplify
The old implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    /\A.*\Z/ !~ ('abc' * 20_000_000)
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5868 MB
    62.226 MB

    real    0m1.307s
    user    0m0.452s
    sys     0m0.797s

The new implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    ('abc' * 20_000_000).include?("\n")
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5861 MB
    62.226 MB

    real    0m0.132s
    user    0m0.088s
    sys     0m0.042s

https://github.com/ruby/irb/commit/40d6610baf
2020-03-26 17:41:21 +09:00
Yusuke Endoh 7e2ed7d1aa [ruby/irb] Add a new easter egg: dancing ruby
https://github.com/ruby/irb/commit/e37dc7e58e
2020-02-02 03:22:51 +09:00
Kenta Murata 93ca212dda [ruby/irb] [ruby/irb] Rewrite an expression to detect multiline
https://github.com/ruby/irb/commit/ed5cf375a6

https://github.com/ruby/irb/commit/5b7bbf9c34
2020-01-21 09:51:26 +09:00
Kenta Murata 51a8055d7d [ruby/irb] Add newline_before_multiline_output
https://github.com/ruby/irb/commit/9eb1801a66
2020-01-21 09:51:16 +09:00
Marcus Stollsteimer 05b0410f91 [ruby/irb] Fix typo
https://github.com/ruby/irb/commit/4bb1340687
2019-12-24 21:22:46 +09:00
Nobuyoshi Nakada e68999c82c
Fixed misspellings
Fixed misspellings reported at [Bug #16437], for default gems.
2019-12-20 12:19:45 +09:00
aycabta 51ea1abb5f Remove e2mmap dependency 2019-11-25 05:38:09 +09:00
Kazuhiro NISHIYAMA 88d6009d91
Use more strict regexp to avoid to match naninanirb.rb 2019-11-21 23:10:30 +09:00
aycabta 91bf3b7a77 Use singleline/multiline instead of readline/reidline 2019-11-21 02:44:35 +09:00
aycabta a5b6d7bca8 Suppress warnings except for when last evaluation
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
2019-11-13 15:15:28 +09:00
Jeremy Evans 652800cc09 Only untaint line on Ruby <2.7
Untaint is deprecated and has no effect on Ruby 2.7+.
2019-11-05 20:54:46 +09:00
zverok 4fe06f4667 IRB: Document command evaluation history. 2019-10-26 10:24:20 -07:00
Jeremy Evans 1fb4584825 Remove unsused output_method argument
Fixes Ruby Bug 9876.
2019-10-24 23:47:50 +09:00
takkanm 87958520f3 set real path to __FILE__ and __dir__ in Binding#irb
When reading Binding#irb, the file of the calling source is reflected in __FILE__ and __dir__.
2019-10-11 09:33:25 +09:00
Steven Willis 9d2fed2ccd Don't echo results of assignment expressions 2019-08-16 06:02:45 +09:00
aycabta 43b52ac0a5 Revert "Don't echo results of assignment expressions"
This reverts commit 1ee88c51b3.
2019-08-06 20:28:48 +09:00
Steven Willis 1ee88c51b3 Don't echo results of assignment expressions 2019-08-06 20:15:07 +09:00
Yusuke Endoh c683763865 Use source_location instead of eval(__FILE__,binding) in Binding#irb
e9e17cbc05 (enabling the warning by
default) caused a warning in test-spec:
```
/data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/irb_spec.rb
Binding#irb
- creates an IRB session with the binding in scope/data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/fixtures/irb.rb:3: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
```
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190802T213005Z.log.html.gz

ref: [Bug #4352]
2019-08-03 07:44:44 +09:00
aycabta 10d7b39d5d Check wether prompt_i is nil 2019-07-15 02:58:28 +09:00
aycabta 078e50c5e9 Save history in IRB is enabled by default 2019-07-15 01:16:18 +09:00
aycabta 6d57369105 Auto indent in IRB is enabled by default 2019-07-15 01:07:37 +09:00
aycabta 76851381cb Show "-" if indent level is negative 2019-07-01 21:14:50 +09:00
aycabta d009e321a0 Use IRB.conf[:AUTO_INDENT] setting in multiline mode 2019-06-19 09:19:41 +09:00
aycabta 85ff2d74a2 Avoid auto indent in prompt when dynamic auto indent 2019-06-19 08:28:00 +09:00
Nobuyoshi Nakada aa32465ab3
irb.rb: [DOC] the default prompt includes :PROMPT_N [ci skip] 2019-06-14 15:31:03 +09:00
aycabta f80771f0a9 Use Reline.prompt_proc in IRB 2019-06-14 08:26:06 +09:00
aycabta 260235ce87 Use Reline as Reidline multiline editor in IRB 2019-05-25 02:16:19 +09:00
aycabta 3a9008b984 Add --colorize and --nocolorize options to IRB 2019-05-21 08:57:21 +09:00
aycabta 94b740b249 Use Ripper for IRB
The debug option of IRB is deleted because it's just for IRB's pure Ruby
parser.
2019-04-30 14:40:06 +09:00
Nobuyoshi Nakada e804fcb42c
Fix rdoc in 52cfb17086 2019-04-26 18:54:10 +09:00
Takashi Kokubun 52cfb17086
make sync-default-gems GEM=irb
from e6739d8c66
2019-04-26 18:28:57 +09:00
Takashi Kokubun 94af6cd383
Colorize IRB's code_around_binding
Closes: https://github.com/ruby/ruby/pull/2150
2019-04-26 00:47:39 +09:00
Nobuyoshi Nakada f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta 51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00
aycabta 7f273ac6d0 IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 08:51:20 +00:00
nobu 6d18187371 Fix remaining syntax errors in Binding#irb docs
Apologies for catching those so late.

[Fix GH-2067] [ci skip]

From: Olivier Lacan <hi@olivierlacan.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-13 03:27:16 +00:00
hsbt e913ecfded Backport https://github.com/ruby/irb/pull/2
Fix and improve version string by @stomar

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-12 07:41:10 +00:00