Sha256: e4d9803984b5818356580f69d173132f798fb2572e0414e007873d45b1a60719
Contents?: true
Size: 945 Bytes
Versions: 1
Compression:
Stored size: 945 Bytes
Contents
# encoding: utf-8 require 'tty-color' require 'pastel/alias_importer' require 'pastel/color' require 'pastel/color_resolver' require 'pastel/delegator' require 'pastel/decorator_chain' require '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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pastel-0.7.1 | lib/pastel.rb |