Shellable: Open a REPL within the context of any Ruby object
Imagine you’re building a new Ruby library, and you’d like to provide users with a simple way to experiment with that new library from the inside. Try Shellable.
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Imagine you’re building a new Ruby library, and you’d like to provide users with a simple way to experiment with that new library from the inside. Try Shellable.
Comments
I’m very sorry to do this, but you can just do
irb objor if you have pry, thenpry obj, and if you want to create a small console like script, you can write all the setup code in your script and in the end addPry.startthank you for the feedback! i am struggling to see how to use the
irbapproach you mentioned above. i do see the way forward withpry, i guess i just have become conditioned to usingprywhen something is wrong. so i wanted to try to bring it all up in anirbsession. and from what i can tell,irbdoesn’t want to take any arguments without some of themulti-irbmagic pulled in.i’m always excited to learn new things though, so don’t ever hesitate to provide feedback, and if you have a simpler way forward, i’d love to consider it! i would just like to stick with
irboverpry, so i’m definitely intrigued by the possibility of simplification.Hm, I didn’t even know about multi-irb, but it seems to come standard? At least in my oldest installed ruby (2.2.3) multi-irb is loaded in irb without me having done anything (no RUBY_OPT, no gem installed). And then this works: ``` 2.2.3 :001 > ary = [1,2,3] # => [1, 2, 3] 2.2.3 :002 > irb ary 2.2.3 :001 > self # => [1, 2, 3] 2.2.3 :002 > RUBY_VERSION # => “2.2.3” ``
urgh, seems this comment section does not understand triple-backtick for code. Let’s try HTML:
<pre> 2.2.3 :001 > ary = [1,2,3] # => [1, 2, 3] 2.2.3 :002 > irb ary 2.2.3 :001 > self # => [1, 2, 3] 2.2.3 :002 > RUBY_VERSION # => “2.2.3”</pre>I give up 😂
Post a comment