Sha256: 3875ff5cb5124e04eda4552aac4a8d5dd23de4c4c51aa963833f83165cc087e1
Contents?: true
Size: 776 Bytes
Versions: 5
Compression:
Stored size: 776 Bytes
Contents
require "irb/cmd/nop" module IRB module ExtendCommand class Code < Nop category "Introspection" description "Shows the syntax-highlighted source code of a method" class << self def transform_args(args) if args.strip =~ /\A(?:([\w:]+)([#.]))?(\w+[?!]?)\z/ if $1 if $2 == "#" "#{$1}, #{$1}.instance_method(:#{$3})" else "#{$1}, :#{$3}" end else ":" + $3 end else args end end end def execute(*args) @irb_context.workspace.binding.send(:code, *args) rescue NameError warn "code: Class or method not found." end end end end
Version data entries
5 entries across 5 versions & 1 rubygems