Class: Rafflesia::AnnotationMapping

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/annotations/annotation_mapping.rb

Constant Summary collapse

HASH_ATTRS =
{
  annotation: :annotation,
  is_positionally_mapped: :is_positionally_mapped,
  to_ref: :to_ref,
  warnings: :warnings
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ AnnotationMapping

Returns a new instance of AnnotationMapping.



21
22
23
24
25
26
27
28
# File 'lib/rafflesia/annotations/annotation_mapping.rb', line 21

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @annotation = hash[:annotation] ? Rafflesia::AnnotationRecord.new(hash[:annotation]) : nil
  @is_positionally_mapped = hash[:is_positionally_mapped]
  @to_ref = hash[:to_ref]
  @warnings = (hash[:warnings] || []).map { |item| item ? Rafflesia::SearchWarning.new(item) : nil }
end

Instance Attribute Details

#annotationObject

Returns the value of attribute annotation.



15
16
17
# File 'lib/rafflesia/annotations/annotation_mapping.rb', line 15

def annotation
  @annotation
end

#is_positionally_mappedObject

Returns the value of attribute is_positionally_mapped.



15
16
17
# File 'lib/rafflesia/annotations/annotation_mapping.rb', line 15

def is_positionally_mapped
  @is_positionally_mapped
end

#to_refObject

Returns the value of attribute to_ref.



15
16
17
# File 'lib/rafflesia/annotations/annotation_mapping.rb', line 15

def to_ref
  @to_ref
end

#warningsObject

Returns the value of attribute warnings.



15
16
17
# File 'lib/rafflesia/annotations/annotation_mapping.rb', line 15

def warnings
  @warnings
end