Class: InstanceKey
- Inherits:
-
Struct
- Object
- Struct
- InstanceKey
- Defined in:
- backend/app/lib/user_defined_field_migrator.rb
Instance Attribute Summary (collapse)
-
- (Object) barcode
Returns the value of attribute barcode.
-
- (Object) indicator
Returns the value of attribute indicator.
-
- (Object) resource_component_id
Returns the value of attribute resource_component_id.
-
- (Object) resource_id
Returns the value of attribute resource_id.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (InstanceKey) initialize(resource_id, resource_component_id, barcode, indicator)
constructor
A new instance of InstanceKey.
-
- (Object) to_bytes
-
- (Boolean) valid?
Constructor Details
- (InstanceKey) initialize(resource_id, resource_component_id, barcode, indicator)
Returns a new instance of InstanceKey
306 307 308 309 310 311 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 306 def initialize(resource_id, resource_component_id, , indicator) super(self.class.stringify(resource_id), self.class.stringify(resource_component_id), self.class.stringify(), self.class.stringify(indicator)) end |
Instance Attribute Details
- (Object) barcode
Returns the value of attribute barcode
284 285 286 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 284 def end |
- (Object) indicator
Returns the value of attribute indicator
284 285 286 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 284 def indicator @indicator end |
- (Object) resource_component_id
Returns the value of attribute resource_component_id
284 285 286 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 284 def resource_component_id @resource_component_id end |
- (Object) resource_id
Returns the value of attribute resource_id
284 285 286 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 284 def resource_id @resource_id end |
Class Method Details
+ (Object) from_row(row)
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 286 def self.from_row(row) if row[:barcode].nil? && row[:container1AlphaNumIndicator].nil? && row[:container1NumericIndicator].nil? # This cannot be matched to a TopContainer return nil end = stringify(row[:barcode]) if indicator = nil elsif (indicator = stringify(row[:container1AlphaNumIndicator])) else indicator = sprintf("%g", row[:container1NumericIndicator]) end new(row[:resourceId], row[:resourceComponentId], , indicator) end |
+ (Object) stringify(value)
314 315 316 317 318 319 320 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 314 def self.stringify(value) if value == "" || value.nil? nil else value.to_s end end |
Instance Method Details
- (Object) to_bytes
322 323 324 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 322 def to_bytes Digest::SHA1.digest(self.to_json) end |
- (Boolean) valid?
327 328 329 |
# File 'backend/app/lib/user_defined_field_migrator.rb', line 327 def valid? || indicator end |