Class: Blazer::Annotations
- Inherits:
-
Object
- Object
- Blazer::Annotations
- Defined in:
- lib/blazer/annotations.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
Instance Method Summary collapse
- #call(result) ⇒ Object
-
#initialize(annotations) ⇒ Annotations
constructor
A new instance of Annotations.
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
#annotations ⇒ Object (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 |