summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2023-07-14 16:45:04 +0100
committergit <[email protected]>2023-07-14 15:45:09 +0000
commit174bc2257065785efbbefca797a50f0847bb6062 ()
treee74c9d73c61cb645fe0ea6faba660e4b1b0b85a1 /lib/irb/context.rb
parentbc8cc68aeff7ae3be1353f4077633cda4d30b54b (diff)
[ruby/irb] Fix history-saving feature
(https://.com/ruby/irb/pull/642) * Define RelineInputMethod::HISTORY The HistorySavingAbility module doesn't do anything if the input method class doesn't define HISTORY. - https://.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L10 - https://.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L34 This defines RelineInputMethod::HISTORY to avoid this. * Improve history-saving's ability check Instead of checking the existence of `input_method_class::HISTORY`, we should make every input method class declare if it supports history saving or not. Since the default value is `false`, it shouldn't break any custom input method that inherits from `IRB::InputMethod`. https://.com/ruby/irb/commit/aec7a5b3f5
-rw-r--r--lib/irb/context.rb12
1 files changed, 5 insertions, 7 deletions
@@ -154,8 +154,12 @@ module IRB
def save_history=(val)
IRB.conf[:SAVE_HISTORY] = val
if val
- (IRB.conf[:MAIN_CONTEXT] || self).init_save_history
end
end
@@ -576,11 +580,5 @@ module IRB
command = command_aliases.fetch(command.to_sym, command)
ExtendCommandBundle.load_command(command)&.respond_to?(:transform_args)
end
-
- def init_save_history# :nodoc:
- unless (class<<@io;self;end).include?(HistorySavingAbility)
- @io.extend(HistorySavingAbility)
- end
- end
end
end