Class: Blazer::Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/blazer/annotations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(annotations) ⇒ Annotations

Returns a new instance of Annotations.



5
6
7
# File 'lib/blazer/annotations.rb', line 5

def initialize(annotations)
  @annotations = annotations.values
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



3
4
5
# File 'lib/blazer/annotations.rb', line 3

def annotations
  @annotations
end

Instance Method Details

#call(result) ⇒ Object



9
10
11
12
13
# File 'lib/blazer/annotations.rb', line 9

def call(result)
  return [] unless result.chart_type.in?(["line", "line2"])
  min, max = result.rows.map(&:first).minmax
  annotations.map { |annotation| fetch_annotation(annotation, result, min, max) }.flatten
end