45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/ripl/rc/anchor.rb', line 45
def anchor obj_or_binding
return if Ripl::Rc::Anchor.disabled?
if Ripl.config[:rc_init].nil?
Ripl::Runner.load_rc(Ripl.config[:riplrc])
Ripl.config[:rc_init] = true
end
(Ripl.config[:rc_anchor] ||= []) << obj_or_binding
name = Ripl::Rc::U.short_inspect(obj_or_binding)
Ripl::Shell.create(Ripl.config.merge(
:name => name,
:prompt => "#{name}(#{Ripl.config[:rc_anchor].size})" +
Ripl.config[:prompt])).loop
Ripl.config[:rc_anchor_last] = Ripl.config[:rc_anchor].pop
end
|