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
-
.default_role_type ⇒ Object
Set the default type of implementation for role methods for all contexts.
Class Method Summary collapse
Instance Method Summary collapse
- #new(*args, &block) ⇒ Object
-
#triggers ⇒ Object
Provides a Set of all available trigger methods where behaviors will be applied to the roles before execution and removed afterward.
Class Attribute Details
.default_role_type ⇒ Object
Set the default type of implementation for role methods for all contexts.
54 55 56 |
# File 'lib/surrounded/context.rb', line 54 def self.default_role_type @default_role_type ||= :module end |
Class Method Details
.extended(base) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/surrounded/context.rb', line 29 def self.extended(base) base.class_eval { @triggers = Set.new include InstanceMethods } end |
Instance Method Details
#new(*args, &block) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/surrounded/context.rb', line 36 def new(*args, &block) instance = allocate instance.send(:preinitialize) instance.send(:initialize, *args, &block) instance.send(:postinitialize) instance end |
#triggers ⇒ Object
Provides a Set of all available trigger methods where behaviors will be applied to the roles before execution and removed afterward.
47 48 49 |
# File 'lib/surrounded/context.rb', line 47 def triggers @triggers.dup end |