class Pastel::Detached

A class representing detached color

Attributes

styles[R]

@api private

Public Class Methods

new(color, *styles) click to toggle source

Initialize a detached object

@param [Pastel::Color] color

the color instance

@param [Array] styles

the styles to be applied

@api private

# File lib/pastel/detached.rb, line 17
def initialize(color, *styles)
  @color  = color
  @styles = styles.dup
  freeze
end

Public Instance Methods

[](*args)
Alias for: call
call(*args) click to toggle source

Decorate the values corresponding to styles

@example

@param [String] value

the stirng to decorate with styles

@return [String]

@api public

# File lib/pastel/detached.rb, line 33
def call(*args)
  value = args.join
  @color.decorate(value, *styles)
end
Also aliased as: []
to_proc() click to toggle source

@api public

# File lib/pastel/detached.rb, line 40
def to_proc
  self
end