Module: Ripl::Commands::Core

Defined in:
lib/ripl/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jumpsObject



8
9
10
# File 'lib/ripl/commands.rb', line 8

def self.jumps
  @jumps ||= [Ripl.shell.loop_eval("self")]
end

Instance Method Details

#config(name, val) ⇒ Object



16
17
18
19
# File 'lib/ripl/commands.rb', line 16

def config(name, val)
  Ripl.shell.respond_to?("#{name}=") ? Ripl.shell.send("#{name}=", val) :
    Ripl.config[name] = val
end

#jump(obj) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/ripl/commands.rb', line 21

def jump(obj)
  obj = Core.jumps[obj] || obj if obj.is_a?(Fixnum)
  if !Core.jumps.include?(obj)
    Core.jumps << obj
    Ripl.shell.add_commands(obj)
  end
  Ripl.shell.binding = obj.instance_eval{ binding }
  obj
end

#jumpsObject



31
32
33
# File 'lib/ripl/commands.rb', line 31

def jumps
  Core.jumps
end

#listObject



12
13
14
# File 'lib/ripl/commands.rb', line 12

def list
  Ripl::Commands.instance_methods
end