Class Guard::Interactor
In: lib/guard/interactor.rb
Parent: Object

The interactor reads user input and triggers specific action upon them unless its locked.

Currently the following actions are implemented:

  • stop, quit, exit, s, q, e => Exit Guard
  • reload, r, z => Reload Guard
  • pause, p => Pause Guard
  • Everything else => Run all

It‘s also possible to scope `reload` and `run all` actions to only a specified group or a guard.

@example `backend reload` will only reload backend group @example `spork reload` will only reload rspec guard @example `jasmine` will only run all jasmine specs

Methods

Constants

STOP_ACTIONS = %w[stop quit exit s q e]
RELOAD_ACTIONS = %w[reload r z]
PAUSE_ACTIONS = %w[pause p]

Public Instance methods

Extract action from entry if an existing action is present

@param [String] Interactor entry gets from $stdin @return [Symbol] A guard action

Extract guard or group scope and action from Interactor entry

@example `spork reload` will only reload rspec @example `jasmine` will only run all jasmine specs

@param [String] Interactor entry gets from $stdin @return [Array] entry group or guard scope hash and action

Extract guard or group scope from entry if valid

@param [String] Interactor entry gets from $stdin @return [Hash] An hash with a guard or a group scope

Start the interactor in its own thread.

Kill interactor thread if not current

[Validate]