obsws 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2b42a23b71da1f893d08f8f1ffba2b178dd48cefa35627afd0bcdbf839fd6c7
4
- data.tar.gz: 1654fafec480037f48b39eed30fa36e862b1cafe56d5c5af9e6fcaaa76a1e337
3
+ metadata.gz: 112d9ab40ebc9219946426e476beaf6c489803049382d16feca972e7e14428d1
4
+ data.tar.gz: 561994b90c57837f4f5a496b22ba017fcb0fd4e4dfd946b7e62cdb91441f7253
5
5
  SHA512:
6
- metadata.gz: e54a03b4df1b1e77ab27fe25980ac759ff38c204885e1fdd6d4f07747b1485a8d00bbf77a75a866e2e8fa3d664d44c53cff10e5b9276772894131afbb0c53f8d
7
- data.tar.gz: 0a9c417863aed8279eca8c838db1ddd635b4bc7eaba4fa2bb49e1141a313f9fa20cfeb281e5de79a21393b368e0f660e6beef526bf57505a01449024202abf61
6
+ metadata.gz: da20d79e6e27d739ad0df64505e5ca0ed5e770505589f9fe89f05f8b326fec6df3a7aaaf290cf2d841cd5145475f219feadeb79c8e0f633f76f66b2336361777
7
+ data.tar.gz: '09d3781a1e45dd3631a5e0b300fb998cd03798e53bc51e1888850603ab55e1d8f6d3850315452e20178eebe60e11fb0f7d4a2a250cd0cc6eff4709d22eed623e'
data/lib/obsws/event.rb CHANGED
@@ -28,8 +28,8 @@ module OBSWS
28
28
  ALL = LOW_VOLUME | HIGH_VOLUME
29
29
  end
30
30
 
31
- module EventDirector
32
- include Util::String
31
+ module Director
32
+ using Util::CoreExtensions
33
33
 
34
34
  def observers
35
35
  @observers ||= {}
@@ -50,13 +50,13 @@ module OBSWS
50
50
  end
51
51
 
52
52
  def fire(event, data)
53
- observers[snakecase(event).to_sym]&.each { |block| data.empty? ? block.call : block.call(data) }
53
+ observers[event.snakecase.to_sym]&.each { |block| data.empty? ? block.call : block.call(data) }
54
54
  end
55
55
  end
56
56
 
57
57
  class Client
58
58
  include Logging
59
- include EventDirector
59
+ include Events::Director
60
60
  include Mixin::TearDown
61
61
  include Mixin::OPCodes
62
62
 
data/lib/obsws/mixin.rb CHANGED
@@ -1,16 +1,17 @@
1
1
  module OBSWS
2
2
  module Mixin
3
3
  module Meta
4
- include Util::String
4
+ using Util::CoreExtensions
5
5
 
6
6
  def make_field_methods(*params)
7
7
  params.each do |param|
8
- define_singleton_method(snakecase(param.to_s)) { @resp[param] }
8
+ define_singleton_method(param.to_s.snakecase) { @resp[param] }
9
9
  end
10
10
  end
11
11
  end
12
12
 
13
13
  class MetaObject
14
+ using Util::CoreExtensions
14
15
  include Mixin::Meta
15
16
 
16
17
  def initialize(resp, fields)
@@ -21,7 +22,7 @@ module OBSWS
21
22
 
22
23
  def empty? = @fields.empty?
23
24
 
24
- def attrs = @fields.map { |f| snakecase(f.to_s) }
25
+ def attrs = @fields.map { |f| f.to_s.snakecase }
25
26
  end
26
27
 
27
28
  # Represents a request response object
data/lib/obsws/util.rb CHANGED
@@ -1,15 +1,16 @@
1
1
  module OBSWS
2
2
  module Util
3
- module String
4
- def camelcase(s)
5
- s.split("_").map(&:capitalize).join
6
- end
3
+ module CoreExtensions
4
+ refine String do
5
+ def camelcase
6
+ split("_").map(&:capitalize).join
7
+ end
7
8
 
8
- def snakecase(s)
9
- s
10
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
11
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
12
- .downcase
9
+ def snakecase
10
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
11
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
12
+ .downcase
13
+ end
13
14
  end
14
15
  end
15
16
  end
data/lib/obsws/version.rb CHANGED
@@ -11,7 +11,7 @@ module OBSWS
11
11
  end
12
12
 
13
13
  def patch
14
- 1
14
+ 2
15
15
  end
16
16
 
17
17
  def to_a
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obsws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - onyx_online