Sha256: c9d9504c19d6e8e722e8680827efaca0f629e7d3ccec34561b1b028ac1c6b62f

Contents?: true

Size: 473 Bytes

Versions: 7

Compression:

Stored size: 473 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true
require 'reel/spy'
Reel::Spy::Colors.class_eval do
  alias_method :original_colorize, :colorize

  def colorize(_n, str)
    force_utf8_encoding(str)
  end

  # Returns utf8 encoding of the msg
  # @param [String] msg
  # @return [String] ReturnsReturns utf8 encoding of the msg
  def force_utf8_encoding(msg)
    msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
celluloid_pubsub-1.1.2 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.1.1 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.1.0 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.0.3 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.0.2 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.0.1 lib/celluloid_pubsub/initializers/reel_colors.rb
celluloid_pubsub-1.0.0 lib/celluloid_pubsub/initializers/reel_colors.rb