Method: Roby::Application#each_model

Defined in:
lib/roby/app.rb

#each_model(root_model = nil) {|| ... } ⇒ Object

Enumerate all models registered in this app

It basically enumerate all submodels of all models in #root_models

Parameters:

  • root_model (nil, #each_submodel) (defaults to: nil)

    if non-nil, limit the enumeration to the submodels of this root

Yield Parameters:

  • (#each_submodel)


3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
# File 'lib/roby/app.rb', line 3015

def each_model(root_model = nil, &block)
    return enum_for(__method__, root_model) unless block_given?

    unless root_model
        root_models.each { |m| each_model(m, &block) }
        return
    end

    yield(root_model)
    root_model.each_submodel(&block)
end