0 Replies - 534 Views - Last Post: 10 June 2014 - 11:54 PM Rate Topic: -----

#1 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,425
  • Joined: 28-November 09

Pry Sessions - Save and Load sessions in Pry

Posted 10 June 2014 - 11:54 PM

https://github.com/b...ver/pry-session

Example: http://showterm.io/b...e6ec11b76f6aea0

Save a session:

[2] pry(main)> a = 1
=> 1
[3] pry(main)> Person = Struct.new(:name, :age)
=> Person
[4] pry(main)> brandon = Person.new 'brandon', 23
=> #<struct Person name="brandon", age=23>
[5] pry(main)> save-session person
[6] pry(main)> exit



Reload a session in a new Pry session:

[1] pry(main)> brandon
NameError: undefined local variable or method `brandon' for main:Object
from (pry):1:in `__pry__'
[2] pry(main)> load-session person
[4] pry(main)> a = 1

[5] pry(main)> Person = Struct.new(:name, :age)

[6] pry(main)> brandon = Person.new 'brandon', 23

=> #<struct Person name="brandon", age=23>
[7] pry(main)> brandon
=> #<struct Person name="brandon", age=23>
[8] pry(main)> # MAGIC!
[9] pry(main)> exit


Simple as that!

Is This A Good Question/Topic? 1
  • +

Page 1 of 1