(https://github.com/ruby/irb/pull/761)
* Implement `history` command
Lists IRB input history with indices. Also aliased as `hist`.
* Add tests for `history` command
* Address feedback: `puts` with multiple arguments instead of `join`ing
* Address feedback: Handle nil from splitting an empty input string
* Refactor line truncation
* Add `-g` grep option to `history` command
* Add `history` command to README
* Remove unused `*args` parameter
* Allow spaces to be included in grep
* Allow `/` to be included in grep regex
* Handle `input` being an empty string
* Exclude "#{index}: " from matching the grep regex
* Add new line after joining
https://github.com/ruby/irb/commit/3f9eacbfa9
(https://github.com/ruby/irb/pull/623)
* Rename `ext/history.rb` to `ext/eval_history.rb`
To confusion with `lib/irb/history.rb`
* Add eval_history tests
* Rename eval_history's History to EvalHistory to avoid confusion
(https://github.com/ruby/irb/pull/613)
Since `IRB.conf[:SAVE_HISTORY]` is assigned with 1000 by default, history-saving
is a feature enabled by default. So it should not be treated as an extension,
which adds unnecessary complexity to the code.
(https://github.com/ruby/irb/pull/559)
* Remove unnecessary command argument generation code
Now that all the supported Ruby versions handle splat args and splat kwargs,
we don't need that args generation code anymore.
* Remove unused command definition code
If we look at `@EXTEND_COMMANDS`, all commands are defined in a file, which
means the `if load_file` branch is always executed. Therefore we can drop
the else branch of that condition.
* Avoid defining unnecessary command methods
There's no need to define another command method just to call `Command.execute`.
Ruby implementations like JRuby and TruffleRuby already indicate their
compatibility target with RUBY_VERSION. We don't need to exclude
them from accepting keyword arguments as long as they target 2.7+.
https://github.com/ruby/irb/commit/bf20faa4e6
Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
* Remove unused ATTR_TTY and ATTR_PLAIN constants
They were added in d7d26b51bf
But the references were removed in 1c76845cca
Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
* Remove unused MethodExtender module
It was added in 6cc5d718d7
but it's not used anywhere.
Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
* Remove unused IRB.irb_at_exit
It's not used after aaf4eb4e98
Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
* Remove unused InputCompletor.ignored_modules
It was added in 88311ce3c8
but the reference was removed in 78c74d2425
* Remove unused TracerLoadError constant
This constant was added in cb50fa3738
but never referenced.
---------
https://github.com/ruby/irb/commit/7de0234325
Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
(https://github.com/ruby/irb/pull/498)
When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it.
But because `SimpleDelegator` doesn't delegate private methods, methods like
`require_relative` or `const_get` would cause error, which are needed for
lazily loading commands.
This commit works around this limitation by avoiding those private method calls
when setting up command execution.
(https://github.com/ruby/irb/pull/475)
In the long-term, we want to align with `Pry`, `byebug` and `debug` to
use the `help` command to list all commands, which is what `show_cmds`
currently does. And `show_doc` will be the command to look up Ruby APIs.
By aliasing `show_doc` to the current `help` now, users will have time
to get use to it.
(https://github.com/ruby/irb/pull/449)
* Seamlessly integrate a few debug commands
* Improve the break command support
* Utilize skip_src option if available
* Add step and delete commands
* Write end-to-end tests for each debugger command
* Add documentation
* Add backtrace, info, catch commands
https://github.com/ruby/irb/commit/976100c1c2
If you call `binding.irb` on a class defined `#print`, it will crash, so call `Kernel.print`.
Fix [Bug #18389] `binding.irb` can fail in some classes that implement `context` and `print` methods.
https://github.com/ruby/irb/commit/d54b271984
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
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RDoc. a patch from Eric Hodel <drbrain at segment7.net>.
[ruby-core:08522]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e