Class: NewlineHw::GuiTrigger
- Inherits:
-
Object
- Object
- NewlineHw::GuiTrigger
- Defined in:
- lib/newline_hw/gui_trigger.rb
Instance Attribute Summary collapse
-
#editor ⇒ Object
readonly
Returns the value of attribute editor.
Instance Method Summary collapse
- #application ⇒ Object
- #call ⇒ Object
-
#initialize(data, config) ⇒ GuiTrigger
constructor
A new instance of GuiTrigger.
Constructor Details
#initialize(data, config) ⇒ GuiTrigger
Returns a new instance of GuiTrigger.
9 10 11 12 |
# File 'lib/newline_hw/gui_trigger.rb', line 9 def initialize(data, config) @newline_submission_id = data["id"] @application = config.terminal end |
Instance Attribute Details
#editor ⇒ Object (readonly)
Returns the value of attribute editor.
8 9 10 |
# File 'lib/newline_hw/gui_trigger.rb', line 8 def editor @editor end |
Instance Method Details
#application ⇒ Object
14 15 16 17 |
# File 'lib/newline_hw/gui_trigger.rb', line 14 def application return "Terminal".freeze unless %w(iTerm2 Terminal).include?(@application) @application end |
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/newline_hw/gui_trigger.rb', line 19 def call applescript = case application when "iTerm2" applescript_for_iterm else applescript_for_terminal end { terminal_output: `osascript -e '#{applescript}'` } end |