mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-01-12 22:49:55 +08:00
Merge pull request #633 from clearsightstudio/warn_private_on_return_method
Warn on private on_return method
This commit is contained in:
@@ -61,12 +61,15 @@ module ProMotion
|
||||
alias :close :close_screen
|
||||
|
||||
def send_on_return(args = {})
|
||||
if self.parent_screen && self.parent_screen.respond_to?(:on_return)
|
||||
return unless self.parent_screen
|
||||
if self.parent_screen.respond_to?(:on_return)
|
||||
if args && self.parent_screen.method(:on_return).arity != 0
|
||||
self.parent_screen.send(:on_return, args)
|
||||
else
|
||||
self.parent_screen.send(:on_return)
|
||||
end
|
||||
elsif self.parent_screen.private_methods.include?(:on_return)
|
||||
PM.logger.warn "#{self.parent_screen.inspect} has an `on_return` method, but it is private and not callable from the closing screen."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user