Class: AjaxfulRating::StarsBuilder
- Inherits:
-
Object
- Object
- AjaxfulRating::StarsBuilder
- Includes:
- Locale
- Defined in:
- lib/axr/stars_builder.rb
Overview
:nodoc: :nodoc:
Constant Summary
Constant Summary
Constants included from Locale
Instance Attribute Summary (collapse)
-
- (Object) options
readonly
Returns the value of attribute options.
-
- (Object) rateable
readonly
Returns the value of attribute rateable.
-
- (Object) user
readonly
Returns the value of attribute user.
Instance Method Summary (collapse)
-
- (StarsBuilder) initialize(rateable, user_or_static, template, css_builder, options = {})
constructor
A new instance of StarsBuilder.
- - (Object) render
- - (Object) show_value
Methods included from Locale
Constructor Details
- (StarsBuilder) initialize(rateable, user_or_static, template, css_builder, options = {})
A new instance of StarsBuilder
7 8 9 10 11 |
# File 'lib/axr/stars_builder.rb', line 7 def initialize(rateable, user_or_static, template, css_builder, = {}) @user = user_or_static unless user_or_static == :static @rateable, @template, @css_builder = rateable, template, css_builder () end |
Instance Attribute Details
- (Object) options (readonly)
Returns the value of attribute options
5 6 7 |
# File 'lib/axr/stars_builder.rb', line 5 def @options end |
- (Object) rateable (readonly)
Returns the value of attribute rateable
5 6 7 |
# File 'lib/axr/stars_builder.rb', line 5 def rateable @rateable end |
- (Object) user (readonly)
Returns the value of attribute user
5 6 7 |
# File 'lib/axr/stars_builder.rb', line 5 def user @user end |
Instance Method Details
- (Object) render
22 23 24 |
# File 'lib/axr/stars_builder.rb', line 22 def render [:wrap] ? wrapper_tag : end |
- (Object) show_value
13 14 15 16 17 18 19 20 |
# File 'lib/axr/stars_builder.rb', line 13 def show_value if [:show_user_rating] rate = rateable.rate_by(user, [:dimension]) if user rate ? rate.stars : 0 else rateable.rate_average(true, [:dimension]) end end |