diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-24 22:21:49 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-25 07:52:17 +0900 |
commit | 698dde525ad3df1444276ccd28c6349c81af2a19 (patch) | |
tree | f80f0fbe70b175ccf2a2a86198aef6e567217d46 /test/psych | |
parent | 6ca7dc69effddeb63a8fb8f759e29ff8649907ec (diff) | |
download | ruby-698dde525ad3df1444276ccd28c6349c81af2a19.tar.gz |
[ruby/psych] Suppress uninitialized instance variable warnings
In verbose mode, `test_delegator` in `test/psych/visitors/test_yaml_tree.rb` shows following warning.
https://travis-ci.org/ruby/psych/jobs/562435717#L268
```
/home/travis/build/ruby/psych/test/psych/visitors/test_yaml_tree.rb:10: warning: instance variable @obj not initialized
```
This is because `Psych.load` bypasses #initialize with the #init_with method.
https://github.com/ruby/psych/commit/f99523388f
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/visitors/test_yaml_tree.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb index 01f1aecd08..69885ee9c6 100644 --- a/test/psych/visitors/test_yaml_tree.rb +++ b/test/psych/visitors/test_yaml_tree.rb @@ -7,7 +7,7 @@ module Psych class TestDelegatorClass < Delegator def initialize(obj); super; @obj = obj; end def __setobj__(obj); @obj = obj; end - def __getobj__; @obj; end + def __getobj__; @obj if defined?(@obj); end end class TestSimpleDelegatorClass < SimpleDelegator |