Class: TimeBuffer::OsaScriptAppBrowser
- Inherits:
-
OsaScriptApp
- Object
- OsaScriptApp
- TimeBuffer::OsaScriptAppBrowser
- Defined in:
- lib/time_buffer/osa_script_app_browser.rb
Constant Summary collapse
- KNOWN_BROWSERS =
%w[com.google.Chrome]
Instance Attribute Summary
Attributes inherited from OsaScriptApp
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app_bundle_id) ⇒ OsaScriptAppBrowser
constructor
A new instance of OsaScriptAppBrowser.
- #metadata ⇒ Object
- #tab_title ⇒ Object
Methods inherited from OsaScriptApp
Constructor Details
#initialize(app_bundle_id) ⇒ OsaScriptAppBrowser
Returns a new instance of OsaScriptAppBrowser.
17 18 19 |
# File 'lib/time_buffer/osa_script_app_browser.rb', line 17 def initialize(app_bundle_id) @bundle_id = app_bundle_id end |
Class Method Details
.register_known_browsers ⇒ Object
9 10 11 12 13 |
# File 'lib/time_buffer/osa_script_app_browser.rb', line 9 def self.register_known_browsers KNOWN_BROWSERS.each do |bundle_id| OsaScriptAppBuilder.register(app_bundle_id: bundle_id, app_class: self) end end |
Instance Method Details
#metadata ⇒ Object
21 22 23 24 25 |
# File 'lib/time_buffer/osa_script_app_browser.rb', line 21 def { tab_title: tab_title } end |
#tab_title ⇒ Object
27 28 29 |
# File 'lib/time_buffer/osa_script_app_browser.rb', line 27 def tab_title `osascript -e 'tell application "Google Chrome" to get title of active tab of front window'`.strip end |