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_callback ⇒ Proc
You may alternately set the inclusion block using this accessor.
-
#initialization_callback ⇒ Proc
You may alternately set the initializer block using this accessor.
Instance Method Summary collapse
-
#to_include(&block) ⇒ Object
Provide a block that modifies the tool class when the mixin is included.
-
#to_initialize(&block) ⇒ Object
Provide a block that initializes this mixin when the tool is constructed.
Instance Attribute Details
#inclusion_callback ⇒ Proc
You may alternately set the inclusion block using this accessor.
139 140 141 |
# File 'lib/toys/mixin.rb', line 139 def inclusion_callback @inclusion_callback end |
#initialization_callback ⇒ Proc
You may alternately set the initializer block using this accessor.
133 134 135 |
# File 'lib/toys/mixin.rb', line 133 def initialization_callback @initialization_callback end |
Instance Method Details
#to_include(&block) ⇒ Object
Provide a block that modifies the tool class when the mixin is included.
125 126 127 |
# File 'lib/toys/mixin.rb', line 125 def to_include(&block) self.inclusion_callback = block end |
#to_initialize(&block) ⇒ Object
Provide a block that initializes this mixin when the tool is constructed.
117 118 119 |
# File 'lib/toys/mixin.rb', line 117 def to_initialize(&block) self.initialization_callback = block end |