Sha256: 11496a4473fef326281077c3a8a00ce2a1122b8ad57a0127d441ab548a4d4752
Contents?: true
Size: 999 Bytes
Versions: 8
Compression:
Stored size: 999 Bytes
Contents
# encoding: utf-8 require 'tty-color' require_relative 'pastel/alias_importer' require_relative 'pastel/color' require_relative 'pastel/color_resolver' require_relative 'pastel/delegator' require_relative 'pastel/decorator_chain' require_relative 'pastel/version' module Pastel # Raised when the style attribute is not supported InvalidAttributeNameError = Class.new(::ArgumentError) # Raised when the color alias is not supported InvalidAliasNameError = Class.new(::ArgumentError) # Create Pastel chainable API # # @example # pastel = Pastel.new enabled: true # # @return [Delegator] # # @api public def new(options = {}) unless options.key?(:enabled) options[:enabled] = (TTY::Color.windows? || TTY::Color.color?) end color = Color.new(options) importer = AliasImporter.new(color, ENV) importer.import resolver = ColorResolver.new(color) Delegator.for(resolver, DecoratorChain.empty) end module_function :new end # Pastel
Version data entries
8 entries across 8 versions & 2 rubygems