From ec43297b2d082ac85421497ab2dfccfa20e1245e Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 26 Jul 2023 14:55:09 +0100 Subject: [PATCH] check if method exists for scene upate Gemfile --- examples/obs/Gemfile | 2 +- examples/obs/main.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/obs/Gemfile b/examples/obs/Gemfile index 8779099..4c31b12 100644 --- a/examples/obs/Gemfile +++ b/examples/obs/Gemfile @@ -2,4 +2,4 @@ source "https://rubygems.org" -gem "obsws", "~> 0.1.3" +gem "obsws", "~> 0.3.0" diff --git a/examples/obs/main.rb b/examples/obs/main.rb index 6b7cc74..29acbd1 100644 --- a/examples/obs/main.rb +++ b/examples/obs/main.rb @@ -44,7 +44,9 @@ class Main def on_current_program_scene_changed(data) scene = data.scene_name puts "Switched to scene #{scene}" - send("on_#{scene.downcase}") + if respond_to?("on_#{scene.downcase}") + send("on_#{scene.downcase}") + end end def on_exit_started