Class: Merit::Judge
Instance Method Summary collapse
-
#apply_badges ⇒ Object
Grant badge if rule applies.
- #apply_points ⇒ Object
-
#initialize(rule, options = {}) ⇒ Judge
constructor
A new instance of Judge.
Constructor Details
Instance Method Details
#apply_badges ⇒ Object
Grant badge if rule applies. If it doesn’t, and the badge is temporary, then remove it.
17 18 19 20 21 22 23 |
# File 'lib/merit/judge.rb', line 17 def apply_badges if rule_applies? grant_badges else remove_badges if @rule.temporary end end |
#apply_points ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/merit/judge.rb', line 25 def apply_points return unless rule_applies? sashes.each do |sash| point = sash.add_points points, category: category notify_observers( description: I18n.t("merit.granted_points", points: points), merit_object: point, sash_id: point.sash_id ) end end |