Compare commits

...

3 Commits

Author SHA1 Message Date
a4b70b6a98 patch bump 2023-08-29 15:46:00 +01:00
7c20063866 add error class docstrings 2023-08-29 15:45:42 +01:00
7cf05fbe08 use Kernel#Array 2023-08-29 15:45:23 +01:00
4 changed files with 8 additions and 5 deletions

View File

@ -18,10 +18,13 @@ require_relative "obsws/event"
require_relative "obsws/version"
module OBSWS
# Base OBSWS error class
class OBSWSError < StandardError; end
# Raised when a connection fails or times out
class OBSWSConnectionError < OBSWSError; end
# Raised when a request returns an error code
class OBSWSRequestError < OBSWSError
attr_reader :req_name, :code

View File

@ -40,12 +40,12 @@ module OBSWS
end
def register(cbs)
cbs = [cbs] unless cbs.respond_to? :each
cbs = Array(cbs) unless cbs.respond_to? :each
cbs.each { |cb| on(cb.name[3..].to_sym, cb) }
end
def deregister(cbs)
cbs = [cbs] unless cbs.respond_to? :each
cbs = Array(cbs) unless cbs.respond_to? :each
cbs.each { |cb| observers[cb.name[3..].to_sym]&.reject! { |o| cbs.include? o } }
end

View File

@ -24,11 +24,11 @@ module OBSWS
def attrs = @fields.map { |f| snakecase(f.to_s) }
end
class Response < MetaObject; end
# Represents a request response object
class Response < MetaObject; end
class Data < MetaObject; end
# Represents an event data object
class Data < MetaObject; end
module TearDown
def stop_driver

View File

@ -11,7 +11,7 @@ module OBSWS
end
def patch
0
1
end
def to_a