diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-29 22:28:16 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-29 22:28:20 -0300 |
commit | 9ace6a3c7481d06215e29a32101c898be4ed2e23 (patch) | |
tree | 8134736dc282722a79402d7e66eda7d414bb64aa | |
parent | 9c1600f774cb35be69d3e5be350db1b7a3997201 (diff) | |
download | highline-9ace6a3c7481d06215e29a32101c898be4ed2e23.tar.gz |
Fix a subtle bug in default_instance initialization
When calling .new at the body of class definition *before* initialize method
and the others it depends on are not defined it renders a bare instance
without any instance variables properly initialized.
-rwxr-xr-x | lib/highline.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index ea4a47e..e09429e 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -44,8 +44,6 @@ class HighLine include BuiltinStyles include CustomErrors - @default_instance = new - extend SingleForwardable def_single_delegators :@default_instance, :agree, :ask, :choose, :say, :use_color=, :use_color?, :reset_use_color @@ -646,6 +644,8 @@ class HighLine def actual_length(text) Wrapper.actual_length text end + + @default_instance = new end require "highline/string" |