Sha256: 375b97adaaacf5cf008cd8281bf4ed344bfddfcf8fe0a120c458a198439fb1ed

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module Cased
  module CLI
    module Log
      CLEAR   = "\e[0m"
      YELLOW  = "\e[33m"
      BOLD    = "\e[1m"

      def self.string(text)
        [color('[cased]', YELLOW, true), text].join(' ')
      end

      def self.log(text)
        puts string(text)
      end

      def self.color(text, color, bold = false)
        color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
        bold  = bold ? BOLD : ''
        "#{bold}#{color}#{text}#{CLEAR}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cased-ruby-0.4.2 lib/cased/cli/log.rb
cased-ruby-0.4.1 lib/cased/cli/log.rb
cased-ruby-0.4.0 lib/cased/cli/log.rb