Module: Surrounded::Context

Defined in:
lib/surrounded/context.rb,
lib/surrounded/context_errors.rb,
lib/surrounded/context/role_map.rb,
lib/surrounded/context/negotiator.rb

Defined Under Namespace

Modules: InstanceMethods, InvalidRoleType Classes: AccessError, InvalidRole, Negotiator, RoleMap

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.default_role_type=(value) ⇒ Object

Sets the attribute default_role_type

Parameters:

  • value

    the value to set the attribute default_role_type to.



58
59
60
# File 'lib/surrounded/context.rb', line 58

def default_role_type=(value)
  @default_role_type = value
end

Class Method Details

.extended(base) ⇒ Object



28
29
30
31
32
33
# File 'lib/surrounded/context.rb', line 28

def self.extended(base)
  base.class_eval {
    @triggers = Set.new
    include InstanceMethods
  }
end

Instance Method Details

#new(*args, &block) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/surrounded/context.rb', line 35

def new(*args, &block)
  instance = allocate
  instance.send(:preinitialize)
  instance.send(:initialize, *args, &block)
  instance.send(:postinitialize)
  instance
end

#triggersObject

Provides a Set of all available trigger methods where behaviors will be applied to the roles before execution and removed afterward.



46
47
48
# File 'lib/surrounded/context.rb', line 46

def triggers
  @triggers.dup
end