path: root/lib/irb
AgeCommit message (Collapse)Author
5 days[ruby/irb] Set maximum document dialog height bytomoya ishida
preferred_dialog_height provided by Reline (
9 days[ruby/irb] Allow `show_source` for private methodsTSUYUSATO Kitsune
( * Allow `show_source` for private methods Fix * Pend tests on TruffleRuby It seems `eval(..., __LINE__ + 1)` does not work. Other similar tests are also pended on TruffleRuby, so I think it is acceptable. * Use `private_method_defined?` instead of `defined?`
13 days[ruby/irb] Simplify each_top_level_statementtomoya ishida
( * Simplify each_top_level_statement, reduce instance vars * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <> * Remove unused ltype from TestRubyLex#check_state response * Remove unnecessary const path of TerminateLineInput * Combine duplicated code state check into method --------- Co-authored-by: Stan Lo <>
14 days[ruby/irb] Display mod key as `Option` on Darwin platformsAdam Daniels
( Check RUBY_PLATFORM for `darwin` and modify the mod key from `Alt` to `Option`.
2023-05-18[ruby/irb] Refactor RubyLex's input/io methodsStan Lo
( 1. Make `RubyLex#set_input` simply assign the input block. This matches the behavior of `RubyLex#set_prompt`. 2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent` into `#configure_io`.
2023-05-18[ruby/irb] Print deprecation warning for `help` commandStan Lo
( * Give show_doc its own command class * Print deprecation warning for `help` command
2023-04-28[ruby/irb] Retire magic-file.rbStan Lo
( `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: 3ee79e89 But now we expect files to be encoded in UTF-8 and don't specify encoding through magic comments anymore, `MagicFile` can be retired.
2023-04-27[ruby/irb] Simplify Locale#loadStan Lo
( * Simplify Locale#load Instead of loading file content with `MagicFile` and then evaluting it, we can just use `Kernel.load` to load the file. * Remove unused optional argument * Remove unused Locale#require and #toplevel_load
2023-04-27[ruby/irb] Stop using MagicFile for printing help messagesStan Lo
( `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: But now both EN and JA's help-message file are UTF-8 and have removed the encoding comment, we don't need to open them with `MagicFile` anymore.
2023-04-26[ruby/irb] Remove encoding_aliases.rbStan Lo
( We don't have to load another file to define the legacy encoding aliases map because there's only one definition of it. We can define it in locale.rb directly.
2023-04-26[ruby/irb] Fix Locale's encoding lookup for Japanese encodingsStan Lo
( In, `encoding_aliases.rb` was introduced to return the correct encoding object for `ujis` and `euc` encodings. However, the return value of `@@legacy_encoding_alias_map[@encoding_name]` is always overridden by a second look up with `Encoding.find(@encoding_name)`. So the logic didn't work as expected. This commit fixes the problem.
2023-04-24[ruby/irb] Simplify the help command's implementationStan Lo
( The current method-redefining approach brings little benefit, makes it harder to understand the code, and causes warnings like: > warning: method redefined; discarding old execute This patch simplifies it while displaying more helpful message when rdoc couldn't be loaded.
2023-04-24[ruby/irb] Filter out top-level methods when using `lsStan Lo
<Class/Module>` ( Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `<Class/Module>` is specified to be either of those.
2023-04-23[ruby/irb] fix typo in tracer ( Daniju
2023-04-09[ruby/irb] Bump version to 1.6.4ima1zumi
2023-04-08[ruby/irb] Simplify command method definitionStan Lo
( * 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`.
2023-04-05[ruby/irb] Drop Ruby 2.6 supportStan Lo
( * Remove all Ruby 2.6 support * Drop Ruby 2.6 specific testing conditions * Only run Ruby 2.7+ on CI * Bump Ruby requirement to 2.7+
2023-04-02[ruby/irb] Don't check RUBY_ENGINE when deciding whether to accept kargsStan Lo
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+. Co-authored-by: Kevin Menard <>
2023-04-02[ruby/irb] Remove dead code ( Lo
* Remove unused ATTR_TTY and ATTR_PLAIN constants They were added in But the references were removed in Co-authored-by: Alexandre Terrasa <> * Remove unused MethodExtender module It was added in but it's not used anywhere. Co-authored-by: Alexandre Terrasa <> * Remove unused IRB.irb_at_exit It's not used after Co-authored-by: Alexandre Terrasa <> * Remove unused InputCompletor.ignored_modules It was added in but the reference was removed in * Remove unused TracerLoadError constant This constant was added in but never referenced. --------- Co-authored-by: Alexandre Terrasa <>
2023-03-13[ruby/irb] Replace METHOD_IS_A with ===Stan Lo
2023-03-13[ruby/irb] Support inspecting BasicObjectStan Lo
2023-03-07[ruby/irb] Bump version to 1.6.3Stan Lo
2023-03-06[ruby/irb] Improve method completion for string and regexp thattomoya ishida
includes word break characters ( * Improve method completion for string and regexp that includes word break characters * Remove completion-test's assert_not_include because candidates no longer include every possible methods * Add comment about string's method completion regexp Co-authored-by: Stan Lo <> * Add comment about regexp's method completion regexp Co-authored-by: Stan Lo <> --------- Co-authored-by: Stan Lo <>
2023-03-04[ruby/irb] Drop chained methods' completion supportStan Lo
( Consider completion for this example: `` Without type information, it is hard to know the return value of the `bar` method, so the current implementation interates through `ObjectSpace` to get all possible candidates for the second method. In small projects, the performance and accuracy are acceptable. But in bigger projects, the performance is unacceptable and the accuracy is mostly poor. So this commit drops the support for chained methods' completion.
2023-03-03[ruby/irb] Avoid slow symbol completion when completion target is antomoya ishida
empty symbol (
2023-03-02[ruby/irb] Specify metadata to provide richer information onStan Lo (
2023-02-28[ruby/irb] Display and prioritise instance methods in `lsStan Lo
<module/class>` (
2023-02-27[ruby/irb] Add a comment about Rails' patch onStan Lo
Workspace#filter_backtrace ( * Add a comment about Rails' patch on Workspace#filter_backtrace * Update lib/irb/workspace.rb Co-authored-by: Sorah Fukumori <> --------- Co-authored-by: Sorah Fukumori <>
2023-02-27[ruby/irb] Provide more useful message whenStan Lo
`IRB::Inspector#inspect_value` errors ( **Before** ``` irb(main):001:0> c = "foo" (Object doesn't support #inspect) => ``` **After** ``` irb(main):001:0> c = "foo" An error occurred when inspecting the object: #<NoMethodError: undefined method `is_a?' for foo:Cat if obj.is_a?(String) ^^^^^^> Result of Kernel#inspect: #<Cat:0x0000000109090d80 @name="foo"> => ```
2023-02-25[ruby/irb] Remove unused Structima1zumi
2023-02-18[ruby/irb] Remove unused context argument from Worksapce#evaluateStan Lo
( The context argument was introduced in this change: perhaps for potential usages. But after that it's never used.
2023-02-15[ruby/irb] Fix help-message ( Hitoshi
2023-02-12[ruby/irb] Fix colorize backtick symboltomoya ishida
( Co-authored-by: Stan Lo <>
2023-01-14[ruby/irb] Store context in RubyLexStan Lo
Some background for this refactor: 1. Through a RubyLex instance's lifetime, the context passed to its methods should be the same. Given that `Context` is only initialised in `Irb#initialize`, this should be true. 2. When `RubyLex` is initialised, the context object should be accessible. This is also true in all 3 of ``'s invocations. With the above observations, we should be able to store the context in `RubyLex` as an instance variable. And doing so will make `RubyLex`'s instance methods easier to use and maintain.
2023-01-12[ruby/irb] Avoid calling private methods on the main objectStan Lo
( 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.
2023-01-12[ruby/irb] Remove redundant argument defaults from some RubyLexStan Lo
methods ( * Remove unnecessary parameter defaults These methods are always called with tokens specified. So their default `@tokens` value is never used and is misleading. * Remove unnecessary context default * Require tokens for `RubyLex#check_state`
2023-01-11[ruby/irb] Formatting to header stylesHiroshi SHIBATA
2023-01-11[ruby/irb] After Ruby 2.0, coding is always utf-8Hiroshi SHIBATA
2023-01-11[ruby/irb] Removed Release Version and Revisions for old VCS softwareHiroshi SHIBATA
2023-01-11[ruby/irb] Drop unused arguments in `RubyLex`Stan Lo
( * Simplify `RubyLex#set_prompt` It's optional argument is never used by any caller. * Remove the optional `p` argument from `RubyLex#set_input` The argument is only used in a test case, which can be easily replaced by a block argument.
2023-01-04[ruby/irb] workspace.rb cleanupStan Lo
( * Remove unnecessary Binding#source_location check `Binding#source_location` was added in 2.6, which is the minimum supported version now. So this check is no longer necessary. * Remove unused IRB.delete_caller This method was added in the earliest version of IRB: But it's not currently referenced by anything. We can verify this with a org-wide search result:
2023-01-02[ruby/irb] Fix prompt and code mismatchtomoya ishida
( * fix prompt and code mismatch * Add test for prompt and code mismatch bug Co-authored-by: Stan Lo <>
2022-12-27[ruby/irb] Refactor RubyLex#process_literal_typeMau Magnaguagno
( Simplify part of regex ``[_a-zA-Z0-9]`` with equivalent shorthand ``\w``. Replace case-when with match ``$1`` or default value ``?"``, making intention more clear.
2022-12-27[ruby/irb] Fix wrong conf path with XDG_CONFIG_HOME. It should be under the ↵Hiroshi SHIBATA
HOME directory, not current directory
2022-12-26[ruby/irb] fix indent depth calculation after heredoc and embdoctompng
2022-12-26[ruby/irb] fix auto-indent after multiline stringtompng
2022-12-20[ruby/irb] Version 1.6.2Takashi Kokubun
2022-12-20[ruby/irb] Respect DLEXT to force-load debug.soTakashi Kokubun
( Co-authored-by: Nobuyoshi Nakada <> Co-authored-by: Nobuyoshi Nakada <>
2022-12-13[ruby/irb] Version 1.6.1Takashi Kokubun
2022-12-12[ruby/irb] `show_doc` command should take non-string argument tooStan Lo
( Given that `show_doc` already supports syntax like `String#gsub`, it should be able to take it in non-string form too, like `edit` and `show_source` do. This ensures users can have a consistent syntax on argument between different commands.