Skip to content

Commit

Permalink
Change to hide details inside delegator
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jun 28, 2020
1 parent bf54876 commit 60e7012
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/pastel.rb
Expand Up @@ -6,7 +6,6 @@
require_relative "pastel/color"
require_relative "pastel/color_resolver"
require_relative "pastel/delegator"
require_relative "pastel/decorator_chain"
require_relative "pastel/version"

module Pastel
Expand Down Expand Up @@ -37,7 +36,7 @@ def new(enabled: nil, eachline: false)
importer = AliasImporter.new(color, ENV)
importer.import
resolver = ColorResolver.new(color)
Delegator.wrap(resolver, DecoratorChain.empty)
Delegator.wrap(resolver)
end
module_function :new
end # Pastel
4 changes: 2 additions & 2 deletions lib/pastel/delegator.rb
Expand Up @@ -22,7 +22,7 @@ class Delegator
# Wrap resolver and chain
#
# @api public
def self.wrap(resolver, chain)
def self.wrap(resolver, chain = DecoratorChain.empty)
new(resolver, chain)
end

Expand Down Expand Up @@ -110,7 +110,7 @@ def respond_to_missing?(name, include_all = false)
#
# @api private
def evaluate_block(&block)
delegator = self.class.new(resolver, DecoratorChain.empty)
delegator = self.class.wrap(resolver)
delegator.instance_eval(&block)
end
end # Delegator
Expand Down

0 comments on commit 60e7012

Please sign in to comment.