Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Object#method to the Eventable module #359

Merged
merged 1 commit into from
Mar 31, 2014
Merged

Add support for Object#method to the Eventable module #359

merged 1 commit into from
Mar 31, 2014

Conversation

MarkVillacampa
Copy link
Contributor

Hello!
I make heavy use of the Eventable module, and sometimes I find it useful to re-use some methods as events. It looks similar to this:

object.on :my_event, &method(:my_method)

However, Method#to_proc returns a different object each time, and this makes it difficult to unbind the event when the VC gets deallocated. This is easily solved by passing a simple Method object

object.on :my_event, method(:my_method)

My implementation is backwards compatible with the existing one so it shouldn't cause any problem to existing apps.

Also, be aware that the current test suite fails, as Object#method leaks. This bug has been reported and will be fixed in the next RM release (http://hipbyte.myjetbrains.com/youtrack/issue/RM-456).

@clayallsopp
Copy link
Contributor

Wow, Object#method leaking is very unexpected, good thing the test detects it.

Thanks!

@MarkVillacampa
Copy link
Contributor Author

Just a heads up, RM 2.25 fixes the Object#method leak so the specs should be passing now.

@MarkVillacampa MarkVillacampa deleted the eventable-method branch April 8, 2014 10:35
@clayallsopp
Copy link
Contributor

Thanks for the heads up, it is! https://travis-ci.org/rubymotion/BubbleWrap/builds/22304051

clayallsopp added a commit that referenced this pull request Apr 16, 2014
- 'bubble-wrap/http' is now deprecated and will be removed in 2.0, see #308

+ `BW::UIActivityViewController` wrapper added, see #335

+ `BW::NetworkIndicator` added, see #349

 + `BW::Location.get_compass` & `BW::Location.get_compass_once`see #348

+ `NSString#to_color` ARGB support, see #350

+ `Object#method` support for `BW::Reactor`, see #359

* Prevented a possible exception when stopping `BW::Location`, see #358

* Fixed a bug when requiring just 'bubble-wrap/ui'
tutuming pushed a commit to tutuming/BubbleWrap that referenced this pull request Apr 21, 2014
- 'bubble-wrap/http' is now deprecated and will be removed in 2.0, see rubymotion-community#308

+ `BW::UIActivityViewController` wrapper added, see rubymotion-community#335

+ `BW::NetworkIndicator` added, see rubymotion-community#349

 + `BW::Location.get_compass` & `BW::Location.get_compass_once`see rubymotion-community#348

+ `NSString#to_color` ARGB support, see rubymotion-community#350

+ `Object#method` support for `BW::Reactor`, see rubymotion-community#359

* Prevented a possible exception when stopping `BW::Location`, see rubymotion-community#358

* Fixed a bug when requiring just 'bubble-wrap/ui'
Sign up for free to 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.

2 participants