Sha256: 7a16fd1c9e58dca5729e627c67f3d0724d3e4f70264e0a315118c51325f988b7

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

# encoding: utf-8

module Pastel
  # A class representing detached color
  class Detached
    include Equatable

    def initialize(color, *styles)
      @color  = color
      @styles = styles.dup
      freeze
    end

    # Decorate the values corresponding to styles
    #
    # @example
    #
    # @param [String] value
    #   the stirng to decorate with styles
    #
    # @return [String]
    #
    # @api public
    def call(*args)
      value = args.join
      @color.decorate(value, *styles)
    end

    private

    # @api private
    attr_reader :styles
  end # Detached
end # Pastel

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pastel-0.5.0 lib/pastel/detached.rb
pastel-0.4.0 lib/pastel/detached.rb