Sha256: f3e71b9d8c3fb4bd865cd69b607e3c5cdb3b82fba76245ff52f19847d29fd95d
Contents?: true
Size: 782 Bytes
Versions: 12
Compression:
Stored size: 782 Bytes
Contents
module Merit module BadgeRulesMethods # Define rule for granting badges def grant_on(actions, *args, &block) options = args.extract_options! actions = Array.wrap(actions) rule = Rule.new rule.badge_name = options[:badge] rule.level = options[:level] rule.to = options[:to] || :action_user rule.multiple = options[:multiple] || false rule.temporary = options[:temporary] || false rule.model_name = options[:model_name] || actions[0].split('#')[0] rule.block = block actions.each do |action| defined_rules[action] ||= [] defined_rules[action] << rule end end # Currently defined rules def defined_rules @defined_rules ||= {} end end end
Version data entries
12 entries across 12 versions & 1 rubygems