Prevent warning for uninitialized `@cached_options` #129

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@tooky

tooky commented Jun 28, 2013

The current implementation is generating a warning because @cached_options hasn't been initialized when it's first called.

~/.gem/ruby/1.9.3/gems/multi_json-1.7.7/lib/multi_json.rb:10: warning: instance variable @cached_options not initialized

Using the ||= operator prevents this warning, even though it seems like its doing the assignment twice. Not sure if there's a better option?

Steve Tooke
Ensure @cached_options is initialized
The current implementation is generating a warning because `@cached_options` hasn't been initialized when it's first called. 

```
~/.gem/ruby/1.9.3/gems/multi_json-1.7.7/lib/multi_json.rb:10: warning: instance variable @cached_options not initialized
```

Using the `||=` operator prevents this warning, even though it seems like its doing the assignment twice. Not sure if there's a better option?
@coveralls

This comment has been minimized.

Show comment Hide comment
@coveralls

coveralls Jun 28, 2013

Coverage Status

Coverage remained the same when pulling 909989c on tooky:patch-1 into 6ad4124 on intridea:master.

Coverage Status

Coverage remained the same when pulling 909989c on tooky:patch-1 into 6ad4124 on intridea:master.

@rwz rwz closed this in 20a3760 Jul 1, 2013

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