Sha256: b73b5772ffe9a473dc3a76f5871a1f004aad12bd52bc6d47aaecd0f63a8a9683

Contents?: true

Size: 651 Bytes

Versions: 5

Compression:

Stored size: 651 Bytes

Contents

# coding: utf-8

module Pastel
  # Contains logic for resolving styles applied to component
  #
  # Used internally by {Delegator}.
  #
  # @api private
  class ColorResolver
    attr_reader :color

    # Initialize ColorResolver
    #
    # @param [Color] color
    #
    # @api private
    def initialize(color = Color.new)
      @color = color
    end

    # Resolve uncolored string
    #
    # @api private
    def resolve(base, unprocessed_string)
      if base.to_a.last == :detach
        Detached.new(color, *base.to_a[0...-1])
      else
        color.decorate(unprocessed_string, *base)
      end
    end
  end # ColorResolver
end # Pastel

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pastel-0.5.3 lib/pastel/color_resolver.rb
pastel-0.5.2 lib/pastel/color_resolver.rb
pastel-0.5.1 lib/pastel/color_resolver.rb
pastel-0.5.0 lib/pastel/color_resolver.rb
pastel-0.4.0 lib/pastel/color_resolver.rb