Class: NvimControl::Controller
- Inherits:
-
Object
- Object
- NvimControl::Controller
- Defined in:
- lib/nvim_control/controller.rb
Class Method Summary collapse
Class Method Details
.run(action:, payload:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nvim_control/controller.rb', line 8 def run(action:, payload:) return invalid_action_response unless supported_action?(action) JSON.generate(action_response(action: action, payload: payload)) rescue ConnectionError => e format_error("Connection failed", e.) rescue OperationError => e format_error("Control action failed", e.) rescue StandardError => e format_error("Unexpected error", e.) end |
.supported_action?(action) ⇒ Boolean
20 21 22 |
# File 'lib/nvim_control/controller.rb', line 20 def supported_action?(action) ACTIONS.key?(action) end |
.supported_actions ⇒ Object
24 25 26 |
# File 'lib/nvim_control/controller.rb', line 24 def supported_actions ACTIONS.keys end |