Class: Appear::Revealers::MacRevealer

Inherits:
BaseRevealer show all
Defined in:
lib/appear/revealers.rb

Overview

Base class for Mac-terminal revealers.

Direct Known Subclasses

Iterm2, TerminalApp

Instance Method Summary collapse

Methods inherited from BaseRevealer

#call, register!

Methods inherited from BaseService

delegate, #initialize, require_service, required_services

Constructor Details

This class inherits a constructor from Appear::BaseService

Instance Method Details

#reveal_tree(tree) ⇒ Object

Implementation.



66
67
68
69
70
71
72
73
# File 'lib/appear/revealers.rb', line 66

def reveal_tree(tree)
  hits = services.lsof.join_via_tty(tree, services.mac_term.panes)
  actual_hits = hits.uniq {|hit| hit.tty }.
    reject {|hit| services.mac_os.has_gui?(hit.process) }.
    each { |hit| services.mac_term.reveal_pane(hit) }

  return actual_hits.length > 0
end

#supports_tree?(target, rest) ⇒ Boolean

Implementation

Returns:

  • (Boolean)

See Also:



77
78
79
80
81
# File 'lib/appear/revealers.rb', line 77

def supports_tree?(target, rest)
  rest.any? do |process|
    process.name == services.mac_term.app_name && services.mac_os.has_gui?(process)
  end
end