Sha256: 776602ad226f4c4e8e39c4eeb8aa13755e06dc96a9800022c3581dc315855542
Contents?: true
Size: 799 Bytes
Versions: 12
Compression:
Stored size: 799 Bytes
Contents
module Merit # Points are a simple integer value which are given to "meritable" resources # according to rules in +app/models/merit_point_rules.rb+. They are given on # actions-triggered. module PointRulesMethods # Define rules on certaing actions for giving points def score(points, *args, &block) options = args.extract_options! actions = options[:on].kind_of?(Array) ? options[:on] : [options[:on]] options[:to] ||= [:action_user] targets = options[:to].kind_of?(Array) ? options[:to] : [options[:to]] actions.each do |action| actions_to_point[action] = { :to => targets, :score => points } end end # Currently defined rules def actions_to_point @actions_to_point ||= {} end end end
Version data entries
12 entries across 12 versions & 1 rubygems