Class: Quby::Questionnaires::Entities::Charting::Charts

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/quby/questionnaires/entities/charting/charts.rb

Instance Method Summary collapse

Constructor Details

#initializeCharts

Returns a new instance of Charts.



10
11
12
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 10

def initialize
  @charts = []
end

Instance Method Details

#add(chart) ⇒ Object



22
23
24
25
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 22

def add(chart)
  fail "Duplicate chart: #{chart.key} already exists!" if find(chart.key)
  @charts << chart
end

#each(*args, &block) ⇒ Object



31
32
33
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 31

def each(*args, &block)
  @charts.each(*args, &block)
end

#find(key) ⇒ Object



27
28
29
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 27

def find(key)
  @charts.find { |i| i.key == key }
end

#overviewObject



14
15
16
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 14

def overview
  @overview_chart
end

#overview=(chart) ⇒ Object



18
19
20
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 18

def overview=(chart)
  @overview_chart = chart
end

#sizeObject



35
36
37
# File 'lib/quby/questionnaires/entities/charting/charts.rb', line 35

def size
  @charts.size
end