Sha256: 072e52e251ef32bb5ae74c03202daa3a44972259fb8fa7bd2cf901ee046c756b
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 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! options[:to] ||= [:action_user] actions = Array.wrap(options[:on]) Array.wrap(options[:to]).each do |to| rule = Rule.new rule.score = points rule.to = to rule.block = block actions.each do |action| actions_to_point[action] ||= [] actions_to_point[action] << rule end end end # Currently defined rules def actions_to_point @actions_to_point ||= {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
merit-1.0.1 | lib/merit/rules_points.rb |