st0012/irb-ai

Provide a `explain` (or `binding.explain`) method

st0012 opened this issue · 0 comments

Asking users to type explain <expr> in terminal while the expression is likely already written in the code doesn't seem to convenient. So perhaps we can provide a helper like

# some code
explain { foo.bar }

which will:

  1. Read the line to get the foo.bar expression
  2. Open an IRB console at the location
  3. Perform explain foo.bar command underneath as if it's typed by the user
  4. Print the output