Module: ActiveAttr::BlockInitialization
- Extended by:
- ActiveSupport::Concern
- Includes:
- ChainableInitialization
- Included in:
- Model
- Defined in:
- lib/active_attr/block_initialization.rb
Overview
BlockInitialization allows you to build an instance in a block
Including the BlockInitialization module into your class will yield the model instance to a block passed to when creating a new instance.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Object
Initialize a model and build via a block.
Instance Method Details
#initialize {|_self| ... } ⇒ Object
Initialize a model and build via a block
32 33 34 35 |
# File 'lib/active_attr/block_initialization.rb', line 32 def initialize(*) super yield self if block_given? end |