module Pastel
Constants
- InvalidAliasNameError
-
Raised when the color alias is not supported
- InvalidAttributeNameError
-
Raised when the style attribute is not supported
- VERSION
Public Class Methods
Source
# File lib/pastel.rb, line 31 def new(enabled: nil, eachline: false) if enabled.nil? enabled = (TTY::Color.windows? || TTY::Color.color?) end color = Color.new(enabled: enabled, eachline: eachline) importer = AliasImporter.new(color, ENV) importer.import resolver = ColorResolver.new(color) Delegator.wrap(resolver) end
Create Pastel
chainable API
@example
pastel = Pastel.new enabled: true
@param [Boolean] :enabled
whether or not to disable coloring
@param [Boolean] :eachline
whether or not to wrap eachline with separate coloring
@return [Delegator]
@api public
Private Instance Methods
Source
# File lib/pastel.rb, line 31 def new(enabled: nil, eachline: false) if enabled.nil? enabled = (TTY::Color.windows? || TTY::Color.color?) end color = Color.new(enabled: enabled, eachline: eachline) importer = AliasImporter.new(color, ENV) importer.import resolver = ColorResolver.new(color) Delegator.wrap(resolver) end
Create Pastel
chainable API
@example
pastel = Pastel.new enabled: true
@param [Boolean] :enabled
whether or not to disable coloring
@param [Boolean] :eachline
whether or not to wrap eachline with separate coloring
@return [Delegator]
@api public