Module: Ripl::Commands::Core

Included in:
Ripl::Commands
Defined in:
lib/ripl/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jumpsObject



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

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

Instance Method Details

#config(name, val) ⇒ Object



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

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

#jump(obj) ⇒ Object



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

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



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

def jumps
  Core.jumps
end

#listObject



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

def list
  Ripl::Commands.instance_methods
end