Class: CemAcpt::Platform::Base
- Inherits:
-
Object
- Object
- CemAcpt::Platform::Base
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/platform/base.rb
Overview
Base class for all platform classes. This class provides an API for interacting with the underlying platform.
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#node_name ⇒ Object
readonly
Returns the value of attribute node_name.
-
#test_data ⇒ Object
readonly
Returns the value of attribute test_data.
Instance Method Summary collapse
-
#image_name ⇒ Object
Generates or retrieves an image name from the test data.
-
#initialize(config, single_test_data, **run_data) ⇒ Base
constructor
A new instance of Base.
-
#node_data ⇒ Object
Data specific to the current node.
-
#platform_data ⇒ Object
Data common to all nodes of the same platform.
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Methods included from Logging
current_log_config, #current_log_config, current_log_format, #current_log_format, current_log_level, #current_log_level, included, logger, #logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, new_log_level, #new_log_level, new_logger, #new_logger
Constructor Details
#initialize(config, single_test_data, **run_data) ⇒ Base
Returns a new instance of Base.
19 20 21 22 23 24 25 26 |
# File 'lib/cem_acpt/platform/base.rb', line 19 def initialize(config, single_test_data, **run_data) raise ArgumentError, 'single_test_data must be a Hash' unless single_test_data.is_a?(Hash) @config = config @test_data = single_test_data @node_name = @test_data[:node_name] || random_node_name @run_data = run_data end |
Instance Attribute Details
#node_name ⇒ Object (readonly)
Returns the value of attribute node_name.
14 15 16 |
# File 'lib/cem_acpt/platform/base.rb', line 14 def node_name @node_name end |
#test_data ⇒ Object (readonly)
Returns the value of attribute test_data.
14 15 16 |
# File 'lib/cem_acpt/platform/base.rb', line 14 def test_data @test_data end |
Instance Method Details
#image_name ⇒ Object
Generates or retrieves an image name from the test data.
53 54 55 |
# File 'lib/cem_acpt/platform/base.rb', line 53 def image_name @image_name ||= (@config.has?('image_name_builder') ? image_name_builder(@config, test_data) : test_data[:image_name]) end |
#node_data ⇒ Object
Data specific to the current node.
48 49 50 |
# File 'lib/cem_acpt/platform/base.rb', line 48 def node_data raise NotImplementedError, 'node_data must be implemented by the specific platform module' end |
#platform_data ⇒ Object
Data common to all nodes of the same platform.
43 44 45 |
# File 'lib/cem_acpt/platform/base.rb', line 43 def platform_data raise NotImplementedError, 'common_data must be implemented by the specific platform module' end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/cem_acpt/platform/base.rb', line 28 def to_h { node_name: node_name, image_name: image_name, test_data: test_data, platform_data: platform_data, node_data: node_data, } end |
#to_json(*args) ⇒ Object
38 39 40 |
# File 'lib/cem_acpt/platform/base.rb', line 38 def to_json(*args) to_h.to_json(*args) end |