This gem writes attr accessors for all instance variables set in your class's initializer. Blog post here
Add this line to your application's Gemfile:
gem 'all_access'
And then execute:
$ bundle
Or install it yourself as:
$ gem install all_access
don't write attr_accessor
You have a class that is really just a bag of data, and I wanted to access the attributes with dot notation a'la javascript
Yes this is unnecessary
Usage:
class Accessible
include AllAccess
def initialize
@test = "testy"
end
end
accessible = Accessible.new
accessible.test # "testy"
accessible.test = "bacon"
accessible.test # "bacon"
NB. only works on attributes initialized in initializer
- Fork it ( https://github.com/[my-github-username]/all_access/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request