Sha256: a0f6ee3837ec3fd2c1830e9506036c811180938ac472f579b353860e2c6a99d5

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

# 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 Merit
  class PointRules
    include Merit::PointRulesMethods

    def initialize
      # Thanks for voting point
      score 1, on: 'comments#vote'

      # All user's comments earn points
      score 2, to: :user_comments, on: 'comments#vote'

      # Points to voted user
      score 5, to: :user, on: 'comments#vote'

      score 20, on: [
        'comments#create',
        'registrations#update'
      ] do |object|
        if object.class == Comment
          object.name.length > 4
        else
          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
merit-1.6.1 test/dummy/app/models/merit/point_rules.rb
merit-1.6.0 test/dummy/app/models/merit/point_rules.rb