module Utils::IRB::Shell
def receiver_unless_main(method, &block)
-
(String, nil)
- the receiver name if it is not 'main', otherwise nil
Parameters:
-
block
(Proc
) -- an optional block to execute with the receiver name -
method
(Method
) -- the method object to inspect
def receiver_unless_main(method, &block) receiver_name = method.receiver.to_s if receiver_name != 'main' if block block.(receiver_name) else receiver_name end end end