Class: IAmICan::Permission::PArray

Inherits:
Array
  • Object
show all
Defined in:
lib/i_am_i_can/permission/p_array.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pmsObject

Returns the value of attribute pms.



4
5
6
# File 'lib/i_am_i_can/permission/p_array.rb', line 4

def pms
  @pms
end

Instance Method Details

#covered?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/i_am_i_can/permission/p_array.rb', line 16

def covered?
  pred, obj_type, obj_id = pms.to_s.split('_')
  pred.to_sym.in?(self) || :"#{pred}_#{obj_type}".in?(self)
end

#found?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/i_am_i_can/permission/p_array.rb', line 12

def found?
  pms.in? self
end

#matched?(pms_name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/i_am_i_can/permission/p_array.rb', line 6

def matched?(pms_name)
  return false if self.blank?
  self.pms = pms_name.to_sym
  found? || covered?
end