Skip to content

Support on_*_entry, on_*_exit and implicit callback methods being private. - #37

Closed
danp wants to merge 1 commit into
geekq:masterfrom
danp:private-callback-methods
Closed

Support on_*_entry, on_*_exit and implicit callback methods being private.#37
danp wants to merge 1 commit into
geekq:masterfrom
danp:private-callback-methods

Conversation

@danp

@danpdanp commented Oct 15, 2011

Copy link
Copy Markdown

Passing true as the second argument to respond_to? searches methods that have been marked private as well. This patch adds that so callback methods can be private.

@geekq

Copy link
Copy Markdown
Owner

My concern is the compatibility to different Ruby versions. I intend the workflow library to work with Ruby 1.8.6, 1.8.7 and 1.9.*. I remember the old discussions like http://deaddeadgood.com/2008/11/17/rubys-send-method/

@danp

danp commented Oct 25, 2011

Copy link
Copy Markdown
Author

Understood.

According to this, 1.8.6 through 1.9.2 support respond_to? with the second argument.

According to this (and from what I recall, need to do some digging in the source history to verify), only 1.9.1 has the send semantics of only working with public methods. As that blog post says when send didn't work for private methods there was also send! for that, though I'd need to verify that as well.

It's arguable the behavior for 1.9.1 users would be unchanged; though if they saw in the documentation private methods were supported they would be confused when it didn't work for them.

If it's possible, would you be ok with a solution that used send! instead of send when necessary?

@danp

danp commented Oct 6, 2012

Copy link
Copy Markdown
Author

Looks like this was fixed by @dwbutler in 53e7ae1 as part of #53. Closing.

@danpdanp closed this Oct 6, 2012
@korny

Copy link
Copy Markdown

Actually, #53 only fixed this for implicit callbacks, but not for on_*_entry and on_*_exit calls. I'd propose using the smart has_callback? method in run_on_entry and run_on_exit, too.

@korny

Copy link
Copy Markdown

Pull request is in #81.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@danp@geekq@korny