Module: Merit

Extended by:
ActiveSupport::Concern
Defined in:
lib/merit.rb,
lib/merit/rule.rb,
lib/merit/judge.rb,
lib/merit/sash_finder.rb,
app/models/merit/badge.rb,
lib/merit/class_methods.rb,
lib/merit/rules_matcher.rb,
lib/merit/target_finder.rb,
lib/merit/models/base/sash.rb,
lib/merit/base_target_finder.rb,
lib/merit/rank_rules_methods.rb,
lib/merit/badge_rules_methods.rb,
lib/merit/point_rules_methods.rb,
lib/merit/controller_extensions.rb,
lib/merit/models/base/badges_sash.rb,
lib/merit/generators/merit_generator.rb,
lib/merit/reputation_change_observer.rb,
lib/merit/generators/remove_generator.rb,
lib/merit/generators/install_generator.rb,
lib/merit/generators/active_record/merit_generator.rb,
lib/merit/generators/active_record/remove_generator.rb,
lib/merit/generators/active_record/install_generator.rb

Defined Under Namespace

Modules: BadgeRulesMethods, ClassMethods, ControllerExtensions, Generators, Models, PointRulesMethods, RankRulesMethods Classes: Action, ActivityLog, Badge, BadgeNotFound, BadgesSash, BaseTargetFinder, Configuration, Engine, Judge, RankAttributeNotDefined, ReputationChangeObserver, Rule, RulesMatcher, Sash, SashFinder, Score, TargetFinder

Class Method Summary collapse

Class Method Details

.add_observer(class_name) ⇒ Object

Parameters:

  • class_name (String)

    The string version of observer class


34
35
36
# File 'lib/merit.rb', line 34

def self.add_observer(class_name)
  @config.add_observer(class_name)
end

.checks_on_each_requestObject

Check rules on each request


10
11
12
# File 'lib/merit.rb', line 10

def self.checks_on_each_request
  @config.checks_on_each_request
end

.current_user_methodObject

Define current_user_method


24
25
26
27
# File 'lib/merit.rb', line 24

def self.current_user_method
  @config.current_user_method ||
    "current_#{@config.user_model_name.downcase}".to_sym
end

.observersObject


29
30
31
# File 'lib/merit.rb', line 29

def self.observers
  @config.observers
end

.ormObject


14
15
16
# File 'lib/merit.rb', line 14

def self.orm
  @config.orm || :active_record
end

.setup {|@config| ... } ⇒ Object

Yields:

  • (@config)

4
5
6
7
# File 'lib/merit.rb', line 4

def self.setup
  @config ||= Configuration.new
  yield @config if block_given?
end

.user_modelObject

Define user_model_name


19
20
21
# File 'lib/merit.rb', line 19

def self.user_model
  @config.user_model_name.constantize
end