Class: IRB::Command::Whereami

Inherits:
Base show all
Defined in:
lib/irb/command/whereami.rb

Instance Attribute Summary

Attributes inherited from Base

#irb_context

Instance Method Summary collapse

Methods inherited from Base

category, description, execute, help_message, #initialize

Constructor Details

This class inherits a constructor from IRB::Command::Base

Instance Method Details

#execute(_arg) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/irb/command/whereami.rb', line 11

def execute(_arg)
  code = irb_context.workspace.code_around_binding
  if code
    puts code
  else
    puts "The current context doesn't have code."
  end
end