class Tourguide::Renderers::Progress

Public Class Methods

new(context, count, total) click to toggle source
# File lib/tourguide/renderers/progress.rb, line 5
def initialize(context, count, total)
  @context = context
  @count   = count
  @total   = total
end

Public Instance Methods

render() click to toggle source
# File lib/tourguide/renderers/progress.rb, line 11
def render
  return "" if uncountable?
  (0...@total).map do |i|
    css = ['bullet']
    css << 'active' if i == @count
    @context.content_tag(:li, "&bull;".html_safe, class: css.join(' '))
  end.join("\n").html_safe
end
uncountable?() click to toggle source
# File lib/tourguide/renderers/progress.rb, line 20
def uncountable?
  @count.blank? && @total.blank?
end