Sha256: 0000890ae1651c81d31765980384d3a5cbea553fcfef25738423d91990e6a0de

Contents?: true

Size: 988 Bytes

Versions: 19

Compression:

Stored size: 988 Bytes

Contents

# 5 stars is a common ranking use case. They are not given at specified
# actions like badges, you should define a cron job to test if ranks are to be
# granted.
#
# +set_rank+ accepts:
# * :+level+ ranking level (greater is better)
# * :+to+ model or scope to check if new rankings apply
# * :+level_name+ attribute name (default is empty and results in 'level'
#   attribute, if set it's appended like 'level_#{level_name}')

module Merit
  class RankRules
    include Merit::RankRulesMethods

    def initialize
      # set_rank :level => 1, :to => Commiter.active do |commiter|
      #   commiter.repositories.count > 1 && commiter.followers >= 10
      # end
      #
      # set_rank :level => 2, :to => Commiter.active do |commiter|
      #   commiter.branches.count > 1 && commiter.followers >= 10
      # end
      #
      # set_rank :level => 3, :to => Commiter.active do |commiter|
      #   commiter.branches.count > 2 && commiter.followers >= 20
      # end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
merit-1.1.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-1.1.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-1.0.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-1.0.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.10.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.10.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.5 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.4 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.3 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.2 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.9.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.8.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.8.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.7.1 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.7.0 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.6.3 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.6.2 lib/generators/merit/templates/merit_rank_rules.rb
merit-0.6.1 lib/generators/merit/templates/merit_rank_rules.rb