fancybox2 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 305d4f2b4006be7dde72fdfd9374f792338429defd2a9269e0ad8d3cfb1634ce
4
- data.tar.gz: ebedeaabc2cb173c67907f08c8c3b8f7fa0b276c1d516fb56910b7fd1102bf6d
3
+ metadata.gz: a2ebfac4305bcbb63e0c539f2bcf665b3d76103dda23ce778af75b9b4dcab683
4
+ data.tar.gz: c23595776e88b5d3cb58853dca0e394485c0f556cbfded59bc528af3c8d81154
5
5
  SHA512:
6
- metadata.gz: e313af43974ac8ba6e2c0330381ac532f0264f6edcc0ddfa8695bebe726c1d4c35f1ddad561c9d8c07e024b4392e85e46dd9ecc10847c4dd43cce46260d4698c
7
- data.tar.gz: 141e2e29514e61b282893ca7e2a2ac64308addd364d9bff408d9b6828b7bbd5f9c222b8d206af6b61243f952e710f844c1ac55d546e2712e9de2b9dd6e1c8b22
6
+ metadata.gz: 4333bdd2ed269d3f35066558984024baed4b71f776c5c1b3c8813ee99af8cafeb397203c48fe166d0d3890ca5e90a339ed2e2357a491550aad55815b560f42cc
7
+ data.tar.gz: 2df663ca74c34c912d159c2c0b127883d94e3754a236e6b01a3fd0bb2321dfc8ec52365e419fa21598fba476347ad3b1f4d0d237eee34dff8d37c3f369660c9c
@@ -30,6 +30,7 @@ module Fancybox2
30
30
  @logger = options.fetch :logger, create_default_logger
31
31
  @status = :stopped
32
32
  @alive_task = nil
33
+ @configs = {}
33
34
  end
34
35
 
35
36
  def alive_message_data(&block)
@@ -86,20 +87,16 @@ module Fancybox2
86
87
  @on_configs = block
87
88
  return
88
89
  end
89
- @configs = begin
90
- # Try to parse
91
- JSON.parse packet.payload
92
- rescue JSON::ParserError
93
- logger.debug 'on_configs: failed parsing packet as JSON, retrying with YAML'
94
- begin
95
- # Try to parse YAML
96
- YAML.load packet.payload
97
- rescue StandardError
98
- logger.debug 'on_configs: failed parsing packet as YAML. Falling back to raw payload'
99
- # Fallback to original content
100
- packet.payload
101
- end
102
- end
90
+ begin
91
+ # Try to parse
92
+ cfg = JSON.parse packet.payload
93
+ if cfg && cfg['configs']
94
+ self.configs.merge! cfg['configs']
95
+ end
96
+ rescue JSON::ParserError
97
+ logger.debug 'on_configs: failed parsing packet as JSON'
98
+ end
99
+
103
100
  @on_configs.call(packet) if @on_configs
104
101
  end
105
102
 
@@ -193,8 +190,8 @@ module Fancybox2
193
190
  # Call user code
194
191
  @on_start.call(packet) if @on_start
195
192
 
196
- configs = packet ? packet.payload : {}
197
- interval = configs['aliveTimeout'] || 1000
193
+ cfg = packet ? packet.payload : {}
194
+ interval = cfg['aliveTimeout'] || 1000
198
195
  # Start code execution from scratch
199
196
  logger.debug "Received 'start'"
200
197
  @status = :running
@@ -4,34 +4,34 @@ module Fancybox2
4
4
  extend self
5
5
 
6
6
  def identifier
7
- return @indentifier if @indentifier
7
+ return @identifier if @identifier
8
8
 
9
9
  host_os = RbConfig::CONFIG['host_os']
10
- case host_os
11
- when /aix(.+)$/
12
- 'aix'
13
- when /darwin(.+)$/
14
- 'darwin'
15
- when /linux/
16
- 'linux'
17
- when /freebsd(.+)$/
18
- 'freebsd'
19
- when /openbsd(.+)$/
20
- 'openbsd'
21
- when /netbsd(.*)$/
22
- 'netbsd'
23
- when /dragonfly(.*)$/
24
- 'dragonflybsd'
25
- when /solaris2/
26
- 'solaris2'
27
- when /mswin|mingw32|windows/
28
- # No Windows platform exists that was not based on the Windows_NT kernel,
29
- # so 'windows' refers to all platforms built upon the Windows_NT kernel and
30
- # have access to win32 or win64 subsystems.
31
- 'windows'
32
- else
33
- host_os
34
- end
10
+ @identifier = case host_os
11
+ when /aix(.+)$/
12
+ 'aix'
13
+ when /darwin(.+)$/
14
+ 'darwin'
15
+ when /linux/
16
+ 'linux'
17
+ when /freebsd(.+)$/
18
+ 'freebsd'
19
+ when /openbsd(.+)$/
20
+ 'openbsd'
21
+ when /netbsd(.*)$/
22
+ 'netbsd'
23
+ when /dragonfly(.*)$/
24
+ 'dragonflybsd'
25
+ when /solaris2/
26
+ 'solaris2'
27
+ when /mswin|mingw32|windows/
28
+ # No Windows platform exists that was not based on the Windows_NT kernel,
29
+ # so 'windows' refers to all platforms built upon the Windows_NT kernel and
30
+ # have access to win32 or win64 subsystems.
31
+ 'windows'
32
+ else
33
+ host_os
34
+ end
35
35
  end
36
36
  end
37
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fancybox2
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fancybox2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Verlato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk