Class: RoleStrategy::Mongoid::RolesMask::Implementation::Roles

Inherits:
Set
  • Object
show all
Defined in:
lib/roles_mongoid/strategy/multi/roles_mask.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sender, *roles) ⇒ Roles

Returns a new instance of Roles.



41
42
43
44
# File 'lib/roles_mongoid/strategy/multi/roles_mask.rb', line 41

def initialize(sender, *roles)
  super(*roles)
  @model_instance = sender
end

Instance Attribute Details

#model_instanceObject (readonly)

Returns the value of attribute model_instance.



39
40
41
# File 'lib/roles_mongoid/strategy/multi/roles_mask.rb', line 39

def model_instance
  @model_instance
end

Instance Method Details

#<<(role) ⇒ Object



46
47
48
49
# File 'lib/roles_mongoid/strategy/multi/roles_mask.rb', line 46

def <<(role)
  model_instance.roles = super.to_a
  self
end