Method: Roby::Application#definition_file_for

Defined in:
lib/roby/app.rb

#definition_file_for(model) ⇒ Object

Returns the downmost app file that was involved in the given model’s definition



2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
# File 'lib/roby/app.rb', line 2008

def definition_file_for(model)
    return if !model.respond_to?(:definition_location) || !model.definition_location

    model.definition_location.each do |location|
        file = location.absolute_path
        next unless (base_path = find_base_path_for(file))

        relative = Pathname.new(file).relative_path_from(base_path)
        split = relative.each_filename.to_a
        next if split[0] != "models"

        return file
    end
    nil
end