Class: ComplianceEngine::DataLoader
- Inherits:
-
Object
- Object
- ComplianceEngine::DataLoader
- Includes:
- Observable
- Defined in:
- lib/compliance_engine/data_loader.rb
Overview
Load compliance engine data
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(value = {}, key: nil) ⇒ DataLoader
constructor
Initialize a new instance of the ComplianceEngine::DataLoader::File class.
-
#key ⇒ String
Get the key for the data loader.
Constructor Details
#initialize(value = {}, key: nil) ⇒ DataLoader
Initialize a new instance of the ComplianceEngine::DataLoader::File class
14 15 16 17 |
# File 'lib/compliance_engine/data_loader.rb', line 14 def initialize(value = {}, key: nil) self.data = value @key = key end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
19 20 21 |
# File 'lib/compliance_engine/data_loader.rb', line 19 def data @data end |
Instance Method Details
#key ⇒ String
Get the key for the data loader
The key is used to identify the data to observers. If a key is not provided during initialization, a random UUID will be generated.
39 40 41 42 43 44 |
# File 'lib/compliance_engine/data_loader.rb', line 39 def key return @key unless @key.nil? require 'securerandom' @key = "#{data.class}:#{SecureRandom.uuid}" end |