Sha256: aba6695bd0484477e8910ae77820e77fb515ddc9d1cbdc554b38d4bfbd85f512

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

class Expectr
  module Interface
    # Public: Return a Thread which does nothing, representing an interface
    # with no functional interact environment available.
    #
    # Returns a Thread.
    def interact_thread
      Thread.new { }
    end

    # Public: Return an empty Hash representing a case where no action needed
    # to be taken in order to prepare the environment for interact mode.
    #
    # Returns an empty Hash.
    def prepare_interact_interface
      {}
    end

    private

    # Internal: Restore environment (TTY parameters, signal handlers) after
    # leaving interact mode.
    #
    # Returns nothing.
    def restore_environment(env)
      env[:sig].each do |signal, handler|
        trap signal, handler
      end
      unless env[:tty].nil?
        `stty #{env[:tty]}`
      end
      @interact = false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
expectr-2.0.2 lib/expectr/interface.rb
expectr-2.0.1 lib/expectr/interface.rb