Sha256: d228056825384bfc7313c3c1dae8a1c3500a377efb71cb874cb9ac39aea2951c

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Helium
  class Console
    define_formatter_for String do
      def call
        formatted = Helium::Console.format_string(
          object.dump.gsub('\n', "\n"),
          max_width: max_width,
          max_lines: max_lines,
          overflow: overflow,
          ellipses: '..."'
        )

        formatted.lines
          .map { |line| light_green(line) }
          .join
      end

      def max_lines
        case level
          when 1 then nil
          when 2 then 3
          else 1
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
helium-console-0.1.11 lib/helium/console/registry/string.rb
helium-console-0.1.10 lib/helium/console/registry/string.rb
helium-console-0.1.9 lib/helium/console/registry/string.rb
helium-console-0.1.8 lib/helium/console/registry/string.rb