Class: SimpleActivity::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_activity/rule.rb

Class Method Summary collapse

Class Method Details

.get_rules(target_type, rules_set = nil) ⇒ Object

Get a set of rules for specific target, action, and type. The type is normally “cache”. It can also be other things once needed in external libs.

  • get all rules.

Parameters:

  • target (String)

    model class name as string. e.g. “Article”

  • rules_set (String) (defaults to: nil)

    the specific set to get. Default nil

Returns:

  • set of rule when matched. Returns nil when unmatching



14
15
16
17
# File 'lib/simple_activity/rule.rb', line 14

def self.get_rules(target_type, rules_set=nil)
  rules = all_rules.try(:[], target_type)
  rules_set ? rules.try(:[], rules_set) : rules
end