Project

General

Profile

« Previous | Next » 

Revision cb9b885e

Added by st0012 (Stan Lo) almost 3 years ago

[ruby/irb] Store context in RubyLex

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 RubyLex.new'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.

https://github.com/ruby/irb/commit/5c8d3df2df