Class: CanTango::PermissionEngine::Parser::Ownership

Inherits:
Rule
  • Object
show all
Defined in:
lib/cantango/permission_engine/parser/ownership.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#action, #method, #model, #target

Instance Method Summary collapse

Methods inherited from Rule

#initialize, #parse_class, #try_class

Constructor Details

This class inherits a constructor from CanTango::PermissionEngine::Parser::Rule

Instance Attribute Details

#model_classObject (readonly)

Returns the value of attribute model_class.



5
6
7
# File 'lib/cantango/permission_engine/parser/ownership.rb', line 5

def model_class
  @model_class
end

#ownerObject (readonly)

Returns the value of attribute owner.



5
6
7
# File 'lib/cantango/permission_engine/parser/ownership.rb', line 5

def owner
  @owner
end

Instance Method Details

#parseObject



7
8
9
10
11
12
13
14
# File 'lib/cantango/permission_engine/parser/ownership.rb', line 7

def parse
  match = target[/(\w+)#(\w+)/]

  @target = match[$1]
  @owner = match[$2]
  @model_class = try_class
  build_ownership_dsl
end