Method: Roby::Application#log_save_metadata

Defined in:
lib/roby/app.rb

#log_save_metadata(append: true) ⇒ Object

Save #app_metadata in the log directory

Parameters:

  • append (Boolean) (defaults to: true)

    if true (the default), the value returned by #app_metadata is appended to the existing data. Otherwise, it replaces the last entry in the file



1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
# File 'lib/roby/app.rb', line 1659

def (append: true)
    path = File.join(log_dir, "info.yml")

    current =
        if File.file?(path)
            YAML.load(File.read(path)) || []
        else
            []
        end

    if append || current.empty?
        current << 
    else
        current[-1] = 
    end
    File.open(path, "w") do |io|
        YAML.dump(current, io)
    end
end