Class: SimpleActivity::Rule

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

Class Method Summary collapse

Class Method Details

.get_rules_set(target, type = '_cache') ⇒ 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.

Parameters:

  • target (String)

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

  • type (String) (defaults to: '_cache')

    the rule type, default as “cache”. or other types defined by third parties

Returns:

  • set of rule when matched. Returns nil when unmatching



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

def self.get_rules_set(target, type='_cache')
  all_rules.try(:[], target).try(:[], type)
end