ruby/lib/irb/helper_method/base.rb
Stan Lo 4349c7909f [ruby/irb] Memoize helper method instances with Singleton module
(https://github.com/ruby/irb/pull/931)

Some helpers, like Rails console's `app`, requires memoization of the
helper's ivars. To support it IRB needs to memoize helper method instances
as well.

a96c7a6668
2024-04-24 18:32:55 +00:00

16 lines
272 B
Ruby

require "singleton"
module IRB
module HelperMethod
class Base
include Singleton
class << self
def description(description = nil)
@description = description if description
@description
end
end
end
end
end