Sha256: 728b5981fa9ae19d4afb7e74ef4734cef7548667d7fa0221d3d94d7f8e58c468
Contents?: true
Size: 823 Bytes
Versions: 2
Compression:
Stored size: 823 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| defined_rules[action] ||= [] defined_rules[action] << rule end end end # Currently defined rules def defined_rules @defined_rules ||= {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
merit-1.1.1 | lib/merit/rules_points_methods.rb |
merit-1.1.0 | lib/merit/rules_points.rb |