Module: FiveStar::Rateable::ClassMethods

Defined in:
lib/five-star/rateable.rb

Instance Method Summary collapse

Instance Method Details

#configurationFiveStar::Configuration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reference to Configuration used for this rateable instance.

Returns:

See Also:



60
61
62
# File 'lib/five-star/rateable.rb', line 60

def configuration
  @configuration ||= Configuration.new
end

#rate_with(*klasses) ⇒ undefined

Set which rating classes will be used to rate the object using this module. Each class must implement the rater methods, see FiveStar::BaseRater

Examples:

class Film
  include FiveStar.rateable

  rate_with GoreRater, SwearingRater, SexRater
  # ...
end

Parameters:

  • klasses (Class)

    constants referencing classes to rate object included with

Returns:

  • (undefined)

See Also:



37
38
39
# File 'lib/five-star/rateable.rb', line 37

def rate_with(*klasses)
  @rating_klasses = Array(klasses)
end

#rating_klassesArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return which rating classes will be used to rate the object using this module.

Returns:

  • (Array)

    list of classes to rate with

See Also:



49
50
51
# File 'lib/five-star/rateable.rb', line 49

def rating_klasses
  @rating_klasses ||= []
end