Sha256: e563608a9bdc78bd8ed75c032247cfab7dff5c871899aabadfb3b6c1b1f34eff

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module RubyJard
  module Commands
    # Command used to explore stacktrace.
    class OutputCommand < Pry::ClassCommand
      group 'RubyJard'
      description 'Show all current program output'

      match 'output'

      banner <<-BANNER
        Usage: output
      BANNER

      def initialize(*args)
        super(*args)
        @session = (context[:session] || RubyJard::Session)
      end

      def process
        pry_instance.pager.open(
          force_open: true,
          pager_start_at_the_end: true,
          prompt: 'Program output'
        ) do |pager|
          @session.output_buffer.each do |string|
            string.each do |s|
              pager.write(s)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_jard-0.3.0 lib/ruby_jard/commands/jard/output_command.rb