<commit_before>Easier Instance Variable Access
===============================

Ruby’s built-in [`Object#instance_variable_get`](http://ruby-doc.org/core/classes/Object.html#M001028) and [`#instance_variable_set`](http://ruby-doc.org/core/classes/Object.html#M001029) methods are clunky to use because you have to unnecessarily prepend an ‘@’ to the name of the instance variable you pass in—which usually leads to much less readable code in the contexts in which I tend to use these methods. On top of that, they’re poorly named: the method names don’t read like English.

This gem adds two methods to `Object` that fix these problems: `instance_variable` method to replace `instance_variable_get` and `set_instance_variable` method to replace `instance_variable_set`.

Full documentation is at [RubyDoc.info](http://rubydoc.info/gems/easier-instance-variable-access).

Examples
--------

These methods are only available within an instance of a class—like the corresponding built-in Ruby methods—so the following examples are given in that context.

### The usual Ruby way

    instance_variable_get('@user')
    instance_variable_set('@user', new_value)

    name = :user
    instance_variable_get("@#{name}")
    instance_variable_set("@#{name}", new_value)

### Using `easier-instance-variable-access`

    instance_variable(:user)
    set_instance_variable(:user, new_value)

    name = :user
    instance_variable(name)
    set_instance_variable(name, new_value)

Colophon
--------

### Tested with

* Ruby 1.9.2-p180 — 20 May 2011

### Contributing

* [Source](https://github.com/codyrobbins/easier-instance-variable-access)
* [Bug reports](https://github.com/codyrobbins/easier-instance-variable-access/issues)

To send patches, please fork on GitHub and submit a pull request.

### Credits

© 2011 [<NAME>](http://codyrobbins.com/). See LICENSE for details.

* [Homepage](http://codyrobbins.com/software/easier-instance-variable-access)
* [Follow me on Twitter](http://twitter.com/codyrobbins)<commit_msg>Added some links to other gems to the readme.<commit_after>Easier Instance Variable Access
===============================

Ruby’s built-in [`Object#instance_variable_get`](http://ruby-doc.org/core/classes/Object.html#M001028) and [`#instance_variable_set`](http://ruby-doc.org/core/classes/Object.html#M001029) methods are clunky to use because you have to unnecessarily prepend an ‘@’ to the name of the instance variable you pass in—which usually leads to much less readable code in the contexts in which I tend to use these methods. On top of that, they’re poorly named: the method names don’t read like English.

This gem adds two methods to `Object` that fix these problems: `instance_variable` method to replace `instance_variable_get` and `set_instance_variable` method to replace `instance_variable_set`.

Full documentation is at [RubyDoc.info](http://rubydoc.info/gems/easier-instance-variable-access).

Examples
--------

These methods are only available within an instance of a class—like the corresponding built-in Ruby methods—so the following examples are given in that context.

### The usual Ruby way

    instance_variable_get('@user')
    instance_variable_set('@user', new_value)

    name = :user
    instance_variable_get("@#{name}")
    instance_variable_set("@#{name}", new_value)

### Using `easier-instance-variable-access`

    instance_variable(:user)
    set_instance_variable(:user, new_value)

    name = :user
    instance_variable(name)
    set_instance_variable(name, new_value)

Colophon
--------

### See also

If you like this gem, you may also want to check out [To Class](http://codyrobbins.com/software/to-class).

### Tested with

* Ruby 1.9.2-p180 — 20 May 2011

### Contributing

* [Source](https://github.com/codyrobbins/easier-instance-variable-access)
* [Bug reports](https://github.com/codyrobbins/easier-instance-variable-access/issues)

To send patches, please fork on GitHub and submit a pull request.

### Credits

© 2011 [<NAME>](http://codyrobbins.com/). See LICENSE for details.

* [Homepage](http://codyrobbins.com/software/easier-instance-variable-access)
* [My other gems](http://codyrobbins.com/software#gems)
* [Follow me on Twitter](http://twitter.com/codyrobbins)
{'fraction_non_alphanumeric': 0.13160377358490566, 'fraction_numerical': 0.013207547169811321, 'mean_word_length': 4.857734806629834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1015680', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1251, 'n_words': 376}