Class: Necropsy::ResolutionRecord
- Inherits:
-
Data
- Object
- Data
- Necropsy::ResolutionRecord
- Defined in:
- lib/necropsy/models.rb
Instance Attribute Summary collapse
-
#assumptions ⇒ Object
readonly
Returns the value of attribute assumptions.
-
#producer ⇒ Object
readonly
Returns the value of attribute producer.
-
#producer_version ⇒ Object
readonly
Returns the value of attribute producer_version.
-
#resolution ⇒ Object
readonly
Returns the value of attribute resolution.
Class Method Summary collapse
Instance Method Summary collapse
- #identity_key ⇒ Object
-
#initialize(resolution:, producer:, producer_version: nil, assumptions: []) ⇒ ResolutionRecord
constructor
A new instance of ResolutionRecord.
- #to_h ⇒ Object
Constructor Details
#initialize(resolution:, producer:, producer_version: nil, assumptions: []) ⇒ ResolutionRecord
Returns a new instance of ResolutionRecord.
242 243 244 245 246 247 248 |
# File 'lib/necropsy/models.rb', line 242 def initialize(resolution:, producer:, producer_version: nil, assumptions: []) resolution = normalize_resolution(resolution) producer = ModelNormalization.identifier(producer, 'producer') producer_version = ModelNormalization.identifier(producer_version, 'producer_version') if producer_version assumptions = ModelNormalization.string_list(assumptions, 'assumption') super end |
Instance Attribute Details
#assumptions ⇒ Object (readonly)
Returns the value of attribute assumptions
241 242 243 |
# File 'lib/necropsy/models.rb', line 241 def assumptions @assumptions end |
#producer ⇒ Object (readonly)
Returns the value of attribute producer
241 242 243 |
# File 'lib/necropsy/models.rb', line 241 def producer @producer end |
#producer_version ⇒ Object (readonly)
Returns the value of attribute producer_version
241 242 243 |
# File 'lib/necropsy/models.rb', line 241 def producer_version @producer_version end |
#resolution ⇒ Object (readonly)
Returns the value of attribute resolution
241 242 243 |
# File 'lib/necropsy/models.rb', line 241 def resolution @resolution end |
Class Method Details
.from_h(attributes) ⇒ Object
250 251 252 253 254 255 256 257 258 |
# File 'lib/necropsy/models.rb', line 250 def self.from_h(attributes) data = ModelNormalization.attributes(attributes, name) new( resolution: data.fetch('resolution'), producer: data.fetch('producer'), producer_version: data['producer_version'], assumptions: data.fetch('assumptions', []) ) end |
Instance Method Details
#identity_key ⇒ Object
260 261 262 |
# File 'lib/necropsy/models.rb', line 260 def identity_key [resolution.call_site_id, producer, producer_version, assumptions].freeze end |
#to_h ⇒ Object
264 265 266 267 268 269 270 271 |
# File 'lib/necropsy/models.rb', line 264 def to_h { 'resolution' => resolution.to_h, 'producer' => producer, 'producer_version' => producer_version, 'assumptions' => assumptions } end |