Module: FiveStar
- Defined in:
- lib/five-star.rb,
lib/five-star/errors.rb,
lib/five-star/version.rb,
lib/five-star/rateable.rb,
lib/five-star/base_rater.rb,
lib/five-star/configuration.rb,
lib/five-star/rating_calculator.rb
Overview
Base module for library interface
Defined Under Namespace
Modules: Rateable Classes: BaseRater, Configuration, RatingCalculator
Constant Summary collapse
- RatingError =
Exception raised when error calculating occurs.
Class.new(StandardError)
- VERSION =
"1.0.0"
Class Method Summary collapse
-
.base_rater ⇒ Class
The base class of a class that gives a rating and weighting to something that is rateable.
-
.rateable ⇒ Class
Include this in your class that can be rated - this is your domain model object that has various attributes that you need rated.
Class Method Details
.base_rater ⇒ Class
The base class of a class that gives a rating and weighting to something that is rateable. See FiveStar.rateable.
This implements the interface necessary to calculate a rating for the rateable instance. At a minimum this must be build, rating, description and weighting.
The method build will be called on each class with the argument of the instance being rated.
63 64 65 |
# File 'lib/five-star.rb', line 63 def base_rater BaseRater end |
.rateable ⇒ Class
Include this in your class that can be rated - this is your domain model object that has various attributes that you need rated. Being rateable is defined as an object that has attributes on which a rating can be calculated based on varying attributes of that model.
This adds the public class and instance methods from the Rateable module.
31 32 33 |
# File 'lib/five-star.rb', line 31 def rateable Rateable end |