Sha256: d805d685731c25dd40ec1e23ded956c2f351726525d491285fcad1f1ae44f847

Contents?: true

Size: 1.04 KB

Versions: 6487

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative "base"

module Byebug
  module Printers
    #
    # Plain text printer
    #
    class Plain < Base
      def print(path, args = {})
        message = translate(locate(path), args)
        tail = parts(path).include?("confirmations") ? " (y/n) " : "\n"
        message << tail
      end

      def print_collection(path, collection, &block)
        lines = array_of_args(collection, &block).map do |args|
          print(path, args)
        end

        lines.join
      end

      def print_variables(variables, *_unused)
        print_collection("variable.variable", variables) do |(key, value), _|
          value = value.nil? ? "nil" : value.to_s
          if "#{key} = #{value}".size > Setting[:width]
            key_size = "#{key} = ".size
            value = value[0..Setting[:width] - key_size - 4] + "..."
          end

          { key: key, value: value }
        end
      end

      private

      def contents_files
        [File.join(__dir__, "texts", "plain.yml")] + super
      end
    end
  end
end

Version data entries

6,487 entries across 6,484 versions & 29 rubygems

Version Path
cybrid_api_bank_ruby-0.122.57 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.57 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.54 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.54 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.54 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.53 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.53 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.53 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.52 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.52 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.52 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.51 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.51 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.51 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.49 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.49 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.49 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_bank_ruby-0.122.48 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_id_ruby-0.122.48 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb
cybrid_api_organization_ruby-0.122.48 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/printers/plain.rb