Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hboon/weak_attr_accessor
weak_attr_accessor for RubyMotion
https://github.com/hboon/weak_attr_accessor
Last synced: 2 months ago
JSON representation
weak_attr_accessor for RubyMotion
- Host: GitHub
- URL: https://github.com/hboon/weak_attr_accessor
- Owner: hboon
- License: bsd-2-clause
- Created: 2015-01-31T12:07:10.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-31T12:27:34.000Z (almost 10 years ago)
- Last Synced: 2024-04-24T09:03:23.894Z (8 months ago)
- Language: Ruby
- Homepage: http://hboon.com/weak-attribute-accessors-in-rubymotion/
- Size: 117 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#weak\_attr_accessor for [RubyMotion](http://rubymotion.com)
Usage
---
Do this:```ruby
class MainView < UIView
weak_attr_accessor :view_controller
end
```instead of this:
```ruby
class MainView < UIView
def view_controller
@view_controller
enddef view_controller=(obj)
if obj.nil?
@view_controller = nil
else
@view_controller = WeakRef.new(obj)
end
end
end
```Installation
---
1. Add this to your `Gemfile`: `gem 'weak_attr_accessor'`
2. Run `bundle install`License
---
BSD. See LICENSE file.Questions
---
* Email: [[email protected]](mailto:[email protected])
* Web: [http://hboon.com/](http://hboon.com/)
* Twitter: [http://twitter.com/hboon](http://twitter.com/hboon)