diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-29 03:45:02 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-29 03:52:19 -0300 |
commit | 07a9de4f2dd33e76a4e5a62c37de5a912bb618dc (patch) | |
tree | db19c16d53f76bcfb28a0eed22dd527b17b8126b | |
parent | 74454525b43d340396fb64d147d9f620ebae40d5 (diff) | |
download | highline-07a9de4f2dd33e76a4e5a62c37de5a912bb618dc.tar.gz |
Create a default instance and forward class methods to it
-rwxr-xr-x | lib/highline.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index a8b72d4..ea4a47e 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -44,8 +44,14 @@ 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 + def self.default_instance - @default_instance ||= new + @default_instance end def self.default_instance=(highline_instance) |