Module: CukeModeler::Containing
- Included in:
- Model
- Defined in:
- lib/cuke_modeler/containing.rb
Overview
A mix-in module containing methods used by models that contain other models.
Instance Method Summary collapse
Instance Method Details
#each_descendant(&block) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/cuke_modeler/containing.rb', line 7 def each_descendant(&block) children.each do |child_model| block.call(child_model) child_model.each_descendant(&block) if child_model.respond_to?(:each_descendant) end end |
#each_model(&block) ⇒ Object
14 15 16 17 18 |
# File 'lib/cuke_modeler/containing.rb', line 14 def each_model(&block) block.call(self) each_descendant(&block) end |