Sha256: d0c0841c6fe0e6ace79371bd18ad64c5f064761db88092e9a0d134bb67247e43

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

# encoding: utf-8

require 'forwardable'
require 'equatable'
require 'tty-screen'

require 'pastel/ansi'
require 'pastel/alias_importer'
require 'pastel/color'
require 'pastel/color_resolver'
require 'pastel/delegator'
require 'pastel/detached'
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 = {})
    color    = Color.new(options)
    importer = AliasImporter.new(color)
    importer.import
    resolver = ColorResolver.new(color)
    Delegator.for(resolver, DecoratorChain.empty)
  end

  module_function :new
end # Pastel

Version data entries

4 entries across 4 versions & 1 rubygems

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