Sha256: 1f797b2cc2722c785a3c8cab67a05f66ebe1aa500d0a11dc9b9ee8b34cb65c7a

Contents?: true

Size: 898 Bytes

Versions: 3

Compression:

Stored size: 898 Bytes

Contents

require "guard/group"

require "guard/plugin_util"
require "guard/internals/session"
require "guard/internals/scope"
require "guard/runner"

module Guard
  module Internals
    class State
      # Minimal setup for non-interactive commands (list, init, show, etc.)
      def initialize(cmdline_opts)
        @session = Session.new(cmdline_opts)

        @scope = Scope.new

        # NOTE: must be set before anything calls Guard::UI.debug
        Debugging.start if session.debug?
      end

      attr_reader :scope
      attr_reader :session

      # @private api
      # TODO: REMOVE!
      def reset_session(&block)
        Runner.new.run(:stop)
        Notifier.disconnect
        options = @session.options.dup
        @session = Session.new(options)
        block.call
        Runner.new.run(:start)
      ensure
        Notifier.connect(session.notify_options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guard-2.10.5 lib/guard/internals/state.rb
guard-2.10.4 lib/guard/internals/state.rb
guard-2.10.3 lib/guard/internals/state.rb