summaryrefslogtreecommitdiff
path: root/lib/irb/command/whereami.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/command/whereami.rb')
-rw-r--r--lib/irb/command/whereami.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/irb/command/whereami.rb b/lib/irb/command/whereami.rb
new file mode 100644
index 0000000000..c8439f1212
--- /dev/null
+++ b/lib/irb/command/whereami.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module IRB
+ # :stopdoc:
+
+ module Command
+ class Whereami < Base
+ category "Context"
+ description "Show the source code around binding.irb again."
+
+ 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
+ end
+ end
+
+ # :startdoc:
+end