Class: ReportEngine::Html::QuestionStats

Inherits:
QuestionStats show all
Defined in:
lib/report_engine/html/question_stats.rb

Constant Summary collapse

@@odd =
"even"

Instance Method Summary collapse

Methods inherited from QuestionStats

#initialize

Constructor Details

This class inherits a constructor from ReportEngine::QuestionStats

Instance Method Details

#renderObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/report_engine/html/question_stats.rb', line 6

def render
  @canvas.add_content(["<li id='question_#{@id}' class='#{swap_odd}'>",
    "<div class='sort col index'>#{@index}</div>",
    "<div class='sort col question'>#{@text}</div>",
    "<div class='clear'></div>",
    "<div id='question_details_#{@id}_tab' class='question_details'>",
    "<img src='#{@canvas.paint(@chart[:type], @chart)}'/>"].join(' '))
  @canvas.paint(@details[:type], @details)
  @canvas.add_content("</div></li>")
end

#swap_oddObject

Alternates between ‘odd’ and ‘even’



19
20
21
22
23
24
25
# File 'lib/report_engine/html/question_stats.rb', line 19

def swap_odd
  if @@odd == "odd"
    @@odd = "even"
  else
    @@odd = "odd"
  end
end