Class: Heytmux::PaneActions::Expect
- Inherits:
-
Heytmux::PaneAction
- Object
- Heytmux::PaneAction
- Heytmux::PaneActions::Expect
- Defined in:
- lib/heytmux/pane_actions/expect.rb
Overview
Pastes the command onto the pane
Instance Method Summary collapse
Methods inherited from Heytmux::PaneAction
Instance Method Details
#process(window_index, pane_index, body) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/heytmux/pane_actions/expect.rb', line 15 def process(window_index, pane_index, body) regex = Regexp.compile(yield(body)) wait_until do content = Tmux.capture(window_index, pane_index) raise 'Failed to capture pane content' unless $CHILD_STATUS.success? content =~ regex end end |
#validate(body) ⇒ Object
11 12 13 |
# File 'lib/heytmux/pane_actions/expect.rb', line 11 def validate(body) raise ArgumentError, 'Expect condition is empty' if body.to_s.empty? end |