Sha256: 0c0e79f96e713a6f5085869ea272a2cbc084094ca0251c49ec3c15e68790d032

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 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, bold: true), text].join(' ')
      end

      def self.log(text)
        puts string(text)
      ensure
        $stdout.flush
      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

1 entries across 1 versions & 1 rubygems

Version Path
cased-ruby-0.8.0 lib/cased/cli/log.rb