Module: CanCan::Export::Rule

Included in:
Rule
Defined in:
lib/cancan/export/ext/rule.rb

Instance Method Summary collapse

Instance Method Details

#compile(ability, compiler) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/cancan/export/ext/rule.rb', line 5

def compile(ability, compiler)
  {
    matchAll: @match_all,
    baseBehavior: @base_behavior,
    subjects: @subjects.map(&:to_s),
    actions: ability.send(:expand_actions, @actions).map(&:to_s),
    conditions: @conditions,
    blockSource: @block && compiler.to_js(@block)
  }
end