module StarsRenderer

Public Instance Methods

render_stars(rating) click to toggle source
# File lib/star_ratings/star_renderer.rb, line 3
def render_stars(rating)
  p 'ratinggg ==========> ', rating
  do_render_stars(rating, self)
end

Private Instance Methods

do_render_stars(rating,template) click to toggle source
# File lib/star_ratings/star_renderer.rb, line 9
def do_render_stars(rating,template)
  @template = template
  content_tag :div, "&nbsp", :class => "stars rating_#{round_rating(rating).to_s.gsub(".", "_")}"
end
method_missing(*args, &block) click to toggle source
# File lib/star_ratings/star_renderer.rb, line 14
def method_missing(*args, &block)
  @template.send(*args, &block)
end
round_rating(rating) click to toggle source
# File lib/star_ratings/star_renderer.rb, line 18
def round_rating(rating)
  (rating * 2.0).round / 2.0
end