Sha256: 1e0de44038fcd04992955b94193e52fcab5dffb37954568b5ff99430b021a757

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

# frozen_string_literal: true

require 'colorized_string'

module Helium
  class Console
    class ColorizedString < ColorizedString
      def length
        uncolorize.to_s.length
      end

      def colorize(*)
        return self unless Pry.color

        super
      end

      module Helpers
        ColorizedString.colors.each do |color|
          define_method(color) do |string|
            ColorizedString.new(string).colorize(color)
          end
        end

        def length_of(string)
          ColorizedString.new(string).length
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helium-console-0.1.13 lib/helium/console/colorized_string.rb