Module: Toys::Mixin::ModuleMethods
- Defined in:
- lib/toys/mixin.rb
Overview
Methods that will be added to a mixin module object.
Instance Attribute Summary collapse
-
#inclusion ⇒ Proc
The inclusion proc for this mixin.
-
#initializer ⇒ Proc
The initializer proc for this mixin.
Instance Method Summary collapse
-
#on_include(&block) ⇒ self
Set an inclusion proc for this mixin.
-
#on_initialize(&block) ⇒ self
Set the initializer for this mixin.
Instance Attribute Details
#inclusion ⇒ Proc
The inclusion proc for this mixin. This block is evaluated in the tool
class immediately after the mixin is included, and is passed any
arguments provided to the include
directive.
149 150 151 |
# File 'lib/toys/mixin.rb', line 149 def inclusion @inclusion end |
#initializer ⇒ Proc
The initializer proc for this mixin. This proc is evaluated in the
runtime context before execution, and is passed any arguments provided
to the include
directive. It can perform any runtime initialization
needed by the mixin.
127 128 129 |
# File 'lib/toys/mixin.rb', line 127 def initializer @initializer end |
Instance Method Details
#on_include(&block) ⇒ self
Set an inclusion proc for this mixin. This block is evaluated in the
tool class immediately after the mixin is included, and is passed any
arguments provided to the include
directive.
137 138 139 140 |
# File 'lib/toys/mixin.rb', line 137 def on_include(&block) self.inclusion = block self end |
#on_initialize(&block) ⇒ self
Set the initializer for this mixin. This block is evaluated in the
runtime context before execution, and is passed any arguments provided
to the include
directive. It can perform any runtime initialization
needed by the mixin.
114 115 116 117 |
# File 'lib/toys/mixin.rb', line 114 def on_initialize(&block) self.initializer = block self end |