rsmp 0.42.3 → 0.42.4

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: a9f368cd8292402eeed0301ea65feee0e4ce5c88fd60e3c992d25d8b72060724
4
- data.tar.gz: fc14b6c538ffb6674453cfe35d2067ca62cb0cf52a42030422c231cab995ce3c
3
+ metadata.gz: 642a7e572bea5e012126d27c26b33aaf4bff8cb750550e7cb4e83d3ee5563709
4
+ data.tar.gz: 272d4be237cd10b677e5c63ff76fd10bea27b303a505e5ff1ea66806786efbcc
5
5
  SHA512:
6
- metadata.gz: fb4f875c05f517b3ddf9b8e966945bcc72bbb86278c03d85d08547cc44fac7589bf6de89ac370ff1ff5d931ef897e766fcdba7a46bddf9ea43baed8e2ea1576e
7
- data.tar.gz: '095469321f19b0558c45ef4d683bcc0779b567ffa5ffe52a4364d7a603825ea27224c6fd418a416efd87089d1d629f346c04fb709e5929a199560d88f5073c26'
6
+ metadata.gz: 1bf67a5afb33d8c22e91be19f512f34d835685e1776c1a9448be55235ff5fbec1672bf5c5500ff1db62b3c08a7c47a5a22115c56da81a26cf51e0cdaa4e4ab8c
7
+ data.tar.gz: 33dff3c7525579871d731686fb3b4ba1e7890637132839e25b28d192280c4264720a39716fc8e329856d65c33f9f1fbbbec8463b6130885518a46eafa214e05b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.42.3)
4
+ rsmp (0.42.4)
5
5
  async (~> 2.32)
6
6
  colorize (~> 1.1)
7
7
  io-endpoint (~> 0.15)
@@ -3,10 +3,8 @@ module RSMP
3
3
  module Distributor
4
4
  attr_reader :receivers
5
5
 
6
- include Inspect
7
-
8
6
  def inspect
9
- "#<#{self.class.name}:#{object_id}, #{inspector(:@receivers)}>"
7
+ "#<#{self.class.name}:#{object_id}}>"
10
8
  end
11
9
 
12
10
  def initialize_distributor
@@ -2,7 +2,9 @@ module RSMP
2
2
  # Receives items from a Distributor when included as a receiver.
3
3
  # Optionally filter messages using a Filter.
4
4
  module Receiver
5
- include Inspect
5
+ def inspect
6
+ "#<#{self.class.name}:#{object_id}>"
7
+ end
6
8
 
7
9
  def initialize_receiver(distributor, filter: nil)
8
10
  @distributor = distributor
@@ -1,8 +1,6 @@
1
1
  module RSMP
2
2
  # RSMP component base class.
3
3
  class ComponentBase
4
- include Inspect
5
-
6
4
  attr_reader :c_id, :ntsoid, :xnid, :node, :alarms, :statuses,
7
5
  :aggregated_status, :aggregated_status_bools, :grouped
8
6
 
@@ -30,6 +28,10 @@ module RSMP
30
28
  @alarms = {}
31
29
  end
32
30
 
31
+ def inspect
32
+ "#<#{self.class.name}:#{object_id}:#{object_id} c_id:#{@c_id}>"
33
+ end
34
+
33
35
  def now
34
36
  node.now
35
37
  end
@@ -2,8 +2,6 @@ module RSMP
2
2
  # Archive of log items, which can be messages or info items.
3
3
  # All items are timestamped, and stored chronologically.
4
4
  class Archive
5
- include Inspect
6
-
7
5
  attr_reader :items
8
6
 
9
7
  @index = 0
data/lib/rsmp/message.rb CHANGED
@@ -4,8 +4,6 @@ require 'rsmp_schema'
4
4
  module RSMP
5
5
  # Base RSMP message class used to represent parsed and built messages.
6
6
  class Message
7
- include Inspect
8
-
9
7
  attr_reader :now, :attributes, :out, :timestamp # this is an internal timestamp recording when we receive/send
10
8
  attr_accessor :json, :direction
11
9
 
@@ -82,6 +80,10 @@ module RSMP
82
80
  end
83
81
  end
84
82
 
83
+ def inspect
84
+ "#<#{self.class.name}:#{object_id} m_id: #{m_id_short}>"
85
+ end
86
+
85
87
  def type
86
88
  @attributes['type']
87
89
  end
@@ -91,6 +93,8 @@ module RSMP
91
93
  end
92
94
 
93
95
  def self.shorten_m_id(m_id, length = 4)
96
+ return nil unless m_id
97
+
94
98
  m_id[0..(length - 1)]
95
99
  end
96
100
 
@@ -2,7 +2,6 @@ module RSMP
2
2
  # Base class for sites and supervisors.
3
3
  class Node
4
4
  include Logging
5
- include Inspect
6
5
  include Task
7
6
 
8
7
  attr_reader :archive, :logger, :task, :deferred, :error_queue, :clock, :collector
@@ -17,6 +16,10 @@ module RSMP
17
16
  @collect = options[:collect]
18
17
  end
19
18
 
19
+ def inspect
20
+ "#<#{self.class.name}:#{object_id} id: #{site_id}}>"
21
+ end
22
+
20
23
  def now
21
24
  clock.now
22
25
  end
@@ -8,7 +8,6 @@ module RSMP
8
8
 
9
9
  include Logging
10
10
  include Distributor
11
- include Inspect
12
11
  include Task
13
12
  include Modules::State
14
13
  include Modules::Watchdogs
@@ -32,6 +31,10 @@ module RSMP
32
31
  @state_condition = Async::Notification.new
33
32
  end
34
33
 
34
+ def inspect
35
+ "#<#{self.class.name}:#{object_id} state:#{state}}>"
36
+ end
37
+
35
38
  def now
36
39
  node.now
37
40
  end
@@ -159,12 +162,6 @@ module RSMP
159
162
  @collector.start
160
163
  end
161
164
 
162
- def inspect
163
- "#<#{self.class.name}:#{object_id}, #{inspector(
164
- :@acknowledgements, :@settings, :@site_settings
165
- )}>"
166
- end
167
-
168
165
  def clock
169
166
  @node.clock
170
167
  end
@@ -38,12 +38,6 @@ module RSMP
38
38
  @settings = @supervisor.supervisor_settings.clone
39
39
  end
40
40
 
41
- def inspect
42
- "#<#{self.class.name}:#{object_id}, #{inspector(
43
- :@acknowledgements, :@settings, :@site_settings, :@components
44
- )}>"
45
- end
46
-
47
41
  def node
48
42
  supervisor
49
43
  end
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = '0.42.3'.freeze
2
+ VERSION = '0.42.4'.freeze
3
3
  end
data/lib/rsmp.rb CHANGED
@@ -17,7 +17,6 @@ require_relative 'rsmp/command_list'
17
17
  require_relative 'rsmp/helpers/clock'
18
18
  require_relative 'rsmp/helpers/deep_merge'
19
19
  require_relative 'rsmp/helpers/error'
20
- require_relative 'rsmp/helpers/inspect'
21
20
  require_relative 'rsmp/log/logging'
22
21
  require_relative 'rsmp/log/archive'
23
22
  require_relative 'rsmp/log/filtering'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.3
4
+ version: 0.42.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
@@ -173,7 +173,6 @@ files:
173
173
  - lib/rsmp/helpers/clock.rb
174
174
  - lib/rsmp/helpers/deep_merge.rb
175
175
  - lib/rsmp/helpers/error.rb
176
- - lib/rsmp/helpers/inspect.rb
177
176
  - lib/rsmp/log/archive.rb
178
177
  - lib/rsmp/log/colorization.rb
179
178
  - lib/rsmp/log/filtering.rb
@@ -1,41 +0,0 @@
1
- module RSMP
2
- # Custom inspect, to reduce noise
3
- #
4
- # Instance variables of classes starting with Async or RSMP are shown
5
- # with only their class name and object id, which reduces output,
6
- # especially for deep object structures.
7
- # Additionally, a list of variables to shown in short format can be passed.
8
- #
9
- # The short form is generated by using to_s() insted of inspect()
10
- #
11
- # Array#to_s and Hash#to_s usually show items, but here we show just number
12
- # of items, when the short form is requested.
13
- module Inspect
14
- def inspector(*short_items)
15
- instance_variables.map do |var_name|
16
- var = instance_variable_get(var_name)
17
- class_name = var.class.name
18
-
19
- short = short_items.include?(var_name) ||
20
- class_name.start_with?('Async') ||
21
- class_name.start_with?('RSMP')
22
-
23
- if short
24
- if var.is_a?(Array) || var.is_a?(Hash)
25
- "#{var_name}: #<#{class_name}:#{class_name.object_id}, #{var.size} items>"
26
- else
27
- "#{var_name}: #{var}"
28
- end
29
- else
30
- "#{var_name}: #{var.inspect}"
31
- end
32
- end.join(', ')
33
- end
34
-
35
- # override this if you want additional variable to be shown in the short format,
36
- # or ottherwise change the inspect format
37
- def inspect
38
- "#<#{self.class.name}:#{object_id}, #{inspector}>"
39
- end
40
- end
41
- end