Sha256: 4bd23ab0fb73120bb264fdb8e5e3b7032c1b879be31baea534e9f5a95593b0a2

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 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
        sleep 0.25 # Cool down
        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.1 lib/ruby_jard/commands/jard/output_command.rb